@@ -383,37 +383,37 @@ def fcmp(x, y): # fuzzy comparison function
383
383
TESTFN_UNICODE = TESTFN + "-\xe0 \xf2 "
384
384
TESTFN_ENCODING = sys .getfilesystemencoding ()
385
385
386
- # TESTFN_UNENCODEABLE is a filename (str type) that should *not* be able to be
386
+ # TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be
387
387
# encoded by the filesystem encoding (in strict mode). It can be None if we
388
388
# cannot generate such filename.
389
389
if os .name in ('nt' , 'ce' ):
390
390
if sys .getwindowsversion ().platform < 2 :
391
391
# win32s (0) or Windows 9x/ME (1)
392
- TESTFN_UNENCODEABLE = None
392
+ TESTFN_UNENCODABLE = None
393
393
else :
394
394
# Japanese characters (I think - from bug 846133)
395
- TESTFN_UNENCODEABLE = TESTFN + "-\u5171 \u6709 \u3055 \u308c \u308b "
395
+ TESTFN_UNENCODABLE = TESTFN + "-\u5171 \u6709 \u3055 \u308c \u308b "
396
396
try :
397
- TESTFN_UNENCODEABLE .encode (TESTFN_ENCODING )
397
+ TESTFN_UNENCODABLE .encode (TESTFN_ENCODING )
398
398
except UnicodeEncodeError :
399
399
pass
400
400
else :
401
401
print ('WARNING: The filename %r CAN be encoded by the filesystem encoding (%s). '
402
402
'Unicode filename tests may not be effective'
403
- % (TESTFN_UNENCODEABLE , TESTFN_ENCODING ))
404
- TESTFN_UNENCODEABLE = None
403
+ % (TESTFN_UNENCODABLE , TESTFN_ENCODING ))
404
+ TESTFN_UNENCODABLE = None
405
405
else :
406
406
try :
407
407
# ascii and utf-8 cannot encode the byte 0xff
408
408
b'\xff ' .decode (TESTFN_ENCODING )
409
409
except UnicodeDecodeError :
410
410
# 0xff will be encoded using the surrogate character u+DCFF
411
- TESTFN_UNENCODEABLE = TESTFN \
411
+ TESTFN_UNENCODABLE = TESTFN \
412
412
+ b'-\xff ' .decode (TESTFN_ENCODING , 'surrogateescape' )
413
413
else :
414
414
# File system encoding (eg. ISO-8859-* encodings) can encode
415
415
# the byte 0xff. Skip some unicode filename tests.
416
- TESTFN_UNENCODEABLE = None
416
+ TESTFN_UNENCODABLE = None
417
417
418
418
# Save the initial cwd
419
419
SAVEDCWD = os .getcwd ()
0 commit comments