[issue16444] Use support.TESTFN_UNDECODABLE on UNIX
Serhiy Storchaka added the comment: You can uses cpXXX encodings explictly to read or write a file, but these encodings are not used for sys.getfilesystemencoding() (or sys.stdout.encoding). At least CP1251 has been used for many cyrillic locales in before-UTF8 age (I use it sometimes still). For now CP1251 is the default encoding for Byelorussian and Bulgarian: $ grep CP /usr/share/i18n/SUPPORTED be_BY CP1251 bg_BG CP1251 ru_RU.CP1251 CP1251 yi_US CP1255 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16444 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
New submission from Tom Pohl: According to the documentation of the floor division (http://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations), x//y should be equal to math.floor(x/y). However, the result of 1//0.1 is 9.0 (tested on 2.6, 2.7, 3.2). It might be related to the internal representation of floating-point numbers, but for this example I would expect it to come up with the correct values. Cheers, Tom -- components: None messages: 175424 nosy: Tom.Pohl priority: normal severity: normal status: open title: Strange results for floor division (//) with non-integer divisors type: behavior versions: Python 2.6, Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +mark.dickinson, skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16285] Update urllib to RFC 3986
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16285 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Serhiy Storchaka added the comment: Yes, this is related to the internal representation of floating-point numbers. 0.1 is 3602879701896397/36028797018963968 in float. import fractions fractions.Fraction(0.1) Fraction(3602879701896397, 36028797018963968) 36028797018963968 / 3602879701896397 10.0 36028797018963968 // 3602879701896397 9 -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16203] Proposal: add re.fullmatch() method
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16203 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Mark Dickinson added the comment: 9.0 *is* the correct result here. The number that Python stores for 0.1 is an approximation that's actually a little greater than 0.1. -- resolution: - invalid ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Changes by Mark Dickinson dicki...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15880] os.path.split() and long UNC names
Serhiy Storchaka added the comment: I propose to close this issue as won't fix. A long-UNC prefix support is a new feature and can't be applied to 2.7. As workaround use splitunc() in Python prior to 3.1. -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Tom Pohl added the comment: Thanks for your comments. From a technical/numerical point of view I agree with you that the computed result is correct given the floating-point limitations. From a user's point of view (and the documentation seems to agree with me) the result is wrong. The documentation (see link in first post) says: [...] the result is that of mathematical division with the ‘floor’ function applied to the result. math.floor(1/0.1) returns the expected 10.0 and the doc says that the floor division should behave the same. If 9.0 for 1//0.1 is the correct result according to your definition of the floor division then I cannot think of a reasonable use case for the floor division. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8865] select.poll is not thread safe
Christian Schubert added the comment: new proposed fix: forbid concurrent poll() invocation -- Added file: http://bugs.python.org/file27967/issue8865_v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Mark Dickinson added the comment: Tom: there's no reasonable way to define all 3 of /, // and % for floating-point numbers that avoids all user surprises. There are a couple of notes (nos 2 and 3) at the bottom of the documentation page you refer to that attempt to explain some of the potential difficulties here. I cannot think of a reasonable use case for the floor division. Indeed, one has to be careful when using floating-point for *anything* where tiny numerical errors can significant: rounding is another example of this. What's your application? There may be better ways of doing what you're trying to do. If you're working with financial data, you might want to look at the decimal module. If you're working with Python floats (or floating-point arithmetic in *any* programming language), your code has to be robust in the face of small errors. math.floor(1/0.1) returns the expected 10.0 Yep. What happens here is that the exact result of 1 / 0.1 is just a touch under 10.0, but the closest representable float to that exact result is 10.0 itself. So the result of the division is rounded up to 10.0, and then the floor returns 10.0 and the doc says that the floor division should behave the same. Where do the docs say that? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8865] select.poll is not thread safe
Serhiy Storchaka added the comment: The patch LGTM. I doubt about the exception type. May be RuntimeError is more appropriate? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8865] select.poll is not thread safe
Christian Schubert added the comment: I doubt about the exception type. May be RuntimeError is more appropriate? mea culpa, just copypasted without actually looking; fixed in v3 -- Added file: http://bugs.python.org/file27968/issue8865_v3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Martin v. Löwis added the comment: Tom: you are misinterpreting the docs. It says (paraphrased) that the result of x//y equals floor(x mathematically-divided-by y), which is different from floor(x/y). Your computer is not capable of performing the mathematically-divided-by operation; you have to compute it on paper. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Serhiy Storchaka added the comment: Your computer is not capable of performing the mathematically-divided-by operation; you have to compute it on paper. You can compute it with Python. math.floor(1/fractions.Fraction(0.1)) 9 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16218] Python launcher does not support unicode characters
koobs added the comment: Back to green for all branches on FreeBSD, thank you Victor -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16218 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16218] Python launcher does not support unicode characters
Stefan Krah added the comment: The Mountain Lion bots still fail. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16218 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16218] Python launcher does not support unicode characters
STINNER Victor added the comment: Back to green for all branches on FreeBSD, thank you Victor FreeBSD buildbots are green because I disabled the test on undecodable bytes! See issue #16455 which proposes a fix for FreeBSD and OpenIndiana. The Mountain Lion bots still fail. :) Yeah I know, see the issue #16416 which has a patch. I plan to commit it to 3.4, wait for buildbots, and then backport to 3.3. -- Python 3.3 handles non-ASCII almost everywhere. Python 3.4 will probably handle non-ASCII everywhere. Handling *undecodable* bytes is really hard. We cannot use the same code for UNIX and Windows. If we store data as bytes, it solves the issue, but we don't support any Unicode character on Windows anymore. If we store data as Unicode, it's the opposite (ok for Windows, decode error on UNIX). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16218 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers
Changes by Vinay Sajip vinay_sa...@yahoo.co.uk: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers
Nikolay Bryskin added the comment: Vinay, why do you close this feature request? Proposed workaround is just a workaround and even doesn't provide some functionality - for example, it seems impossible to define a terminator using config file. -- resolution: invalid - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15809] IDLE console uses incorrect encoding.
Serhiy Storchaka added the comment: However, this patch isn't right, since it will cause all source to be interpreted as UTF-8. This would be wrong when the sys.stdin.encoding is not UTF-8, and byte string objects are created in interactive mode. Can you show how to reproduce the error that you're talking about? I have found no issues running the bare Python and IDLE (with your patch, of course) with files in different encodings under different locales. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15809] IDLE console uses incorrect encoding.
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15809 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers
Vinay Sajip added the comment: Well, the config file format is older and fileConfig() does not cover as much as dictConfig() does. (For example, filters). I don't propose to spend time enhancing fileConfig(), now that dictConfig() is available. If you are forced to use fileConfig(), you can subclass the handler for those projects where you need custom terminators. This is not much work, and you can use that subclass on all projects where you need custom terminators. What I proposed was not a workaround, exactly - it's how dictConfig() is *meant* to be used. The reason for supporting factories for handlers is that users can set them up however they want. I closed the issue because I showed that no change to the stdlib was needed to provide the functionality requested, and as I got no response about it from you, I decided to close the issue. Sometimes, people see a solution proposed which addresses their problem, but don't close the issue themselves. So, I would like to close this issue, because I have proposed a way you can do what you need without the need to add anything to the stdlib. If you feel the need to reopen the issue, please do so, but give me a good reason why the approach I suggested doesn't work for you. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
STINNER Victor added the comment: macosx-2.patch patches _Py_wchar2char() and _Py_char2wchar() functions to use UTF-8/surrogateescape for any function using the locale encoding, not only file related functions of fileutils.h. The patch does also simplify the code, no more specific #ifdef __APPLE__ in python.c: -#ifdef __APPLE__ -argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i])); -#else argv_copy[i] = _Py_char2wchar(argv[i], NULL); -#endif 2012/11/7 Andrew Svetlov rep...@bugs.python.org Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ -- Added file: http://bugs.python.org/file27969/macosx-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___diff -r 6a6ad09faad2 Modules/python.c --- a/Modules/python.c Mon Nov 12 01:23:51 2012 +0100 +++ b/Modules/python.c Mon Nov 12 14:29:44 2012 +0100 @@ -15,10 +15,6 @@ wmain(int argc, wchar_t **argv) } #else -#ifdef __APPLE__ -extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size); -#endif - int main(int argc, char **argv) { @@ -45,11 +41,7 @@ main(int argc, char **argv) oldloc = strdup(setlocale(LC_ALL, NULL)); setlocale(LC_ALL, ); for (i = 0; i argc; i++) { -#ifdef __APPLE__ -argv_copy[i] = _Py_DecodeUTF8_surrogateescape(argv[i], strlen(argv[i])); -#else argv_copy[i] = _Py_char2wchar(argv[i], NULL); -#endif if (!argv_copy[i]) { free(oldloc); fprintf(stderr, Fatal Python error: diff -r 6a6ad09faad2 Python/fileutils.c --- a/Python/fileutils.cMon Nov 12 01:23:51 2012 +0100 +++ b/Python/fileutils.cMon Nov 12 14:29:44 2012 +0100 @@ -7,6 +7,10 @@ #include langinfo.h #endif +#ifdef __APPLE__ +extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size); +#endif + PyObject * _Py_device_encoding(int fd) { @@ -59,6 +63,15 @@ PyObject * wchar_t* _Py_char2wchar(const char* arg, size_t *size) { +#ifdef __APPLE__ +wchar_t *wstr; +wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg)); +if (wstr == NULL) +return NULL; +if (size != NULL) +*size = wcslen(wstr); +return wstr; +#else wchar_t *res; #ifdef HAVE_BROKEN_MBSTOWCS /* Some platforms have a broken implementation of @@ -144,7 +157,7 @@ wchar_t* argsize -= converted; out++; } -#else +#else /* HAVE_MBRTOWC */ /* Cannot use C locale for escaping; manually escape as if charset is ASCII (i.e. escape all bytes 128. This will still roundtrip correctly in the locale's charset, which must be an ASCII superset. */ @@ -159,7 +172,7 @@ wchar_t* else *out++ = 0xdc00 + *in++; *out = 0; -#endif +#endif /* HAVE_MBRTOWC */ if (size != NULL) *size = out - res; return res; @@ -167,6 +180,7 @@ oom: if (size != NULL) *size = (size_t)-1; return NULL; +#endif /* __APPLE__ */ } /* Encode a (wide) character string to the locale encoding with the @@ -183,6 +197,34 @@ oom: char* _Py_wchar2char(const wchar_t *text, size_t *error_pos) { +#ifdef __APPLE__ +Py_ssize_t len; +PyObject *unicode, *bytes = NULL; +char *cpath; + +unicode = PyUnicode_FromWideChar(text, wcslen(text)); +if (unicode == NULL) { +Py_DECREF(unicode); +return NULL; +} + +bytes = _PyUnicode_AsUTF8String(unicode, surrogateescape); +Py_DECREF(unicode); +if (bytes == NULL) { +PyErr_Clear(); +return NULL; +} + +len = PyBytes_GET_SIZE(bytes); +cpath = PyMem_Malloc(len+1); +if (cpath == NULL) { +Py_DECREF(bytes); +return NULL; +} +memcpy(cpath, PyBytes_AsString(bytes), len + 1); +Py_DECREF(bytes); +return cpath; +#else /* __APPLE__ */ const size_t len = wcslen(text); char *result = NULL, *bytes = NULL; size_t i, size, converted; @@ -242,6 +284,7 @@ char* bytes = result; } return result; +#endif /* __APPLE__ */ } /* In principle, this should use HAVE__WSTAT, and _wstat ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers
Nikolay Bryskin added the comment: Actually, I'm using dictConfig to load config from json file. And yes, ext:// provides a way to load custom handler, but, as far as I see (https://github.com/jonashaag/cpython/blob/master/Lib/logging/config.py#L379-404), there is no possibility to specify custom parameters - terminator, for example. My proposal is to add this existing documented configurable parameter of standard logging handlers to constructors to make it configurable. Also, there is a demand for configurable errors handler for encoding/decoding strings, but I think it should be another issue. For now I'm just using derived classes in my project to achieve this functionality, is it really the right way (instead of patching stdlib)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Tom Pohl added the comment: Thanks for all the explanations why Python's floor division (FD) works as specified. And I agree, it does work as specified, but still, I think this is not the behavior that most people would expect and is therefore dangerous to provide/use. What do I expect from FD (x//y): 1. Perform a division (I don't care about the details here). 2. Return an integer value q (even if it's stored in a float). 3. The absolute difference between the mathematical division q'=x/y and the returned result q is less than 1, since it's just a floor operation, right? 1//0.1 = 9.0 violates my personal last expectation and I guess I'm not the only one. My use case: I need to perform a division, but the method only accepts integer values, so what I used to do is FD. Since today I'm using int(x/y) or floor(x/y). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Tom Pohl added the comment: Martin: Ok, just as you suggested, I did the calculations on a sheet of paper: floor(1 mathematically-divided-by 0.1) = floor(10) = 10 qed ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Stefan Krah added the comment: Any programming language that uses binary floats behaves like that and it is actually what people expect. If you want behavior that is closer to pencil and paper calculations, you need to use decimal: Decimal(1) // Decimal(0.1) Decimal('10') Contrast with: Decimal(1) // Decimal(0.1) Decimal('9') The reason: Decimal(0.1) Decimal('0.1') Decimal(0.1) Decimal('0.155511151231257827021181583404541015625') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set
STINNER Victor added the comment: Hijacking locale.getpreferredencoding() is maybe dangerous. I attached a new patch, force_ascii.patch, which uses a different approach: be more strict than mbstowcs(), force the ASCII encoding when: - the LC_CTYPE locale is C - nl_langinfo(CODESET) is ASCII or an alias of ASCII - mbstowcs() is able to decode non-ASCII characters 2012/11/12 STINNER Victor rep...@bugs.python.org STINNER Victor added the comment: Some tests are failing with the patch: == FAIL: test_undecodable_env (test.test_subprocess.POSIXProcessTestCase) -- Traceback (most recent call last): File /usr/home/haypo/prog/python/default/Lib/test/test_subprocess.py, line 1606, in test_undecodable_env self.assertEqual(stdout.decode('ascii'), ascii(value)) AssertionError: 'abc\\xff' != 'abc\\udcff' - 'abc\xff' ? ^ + 'abc\udcff' ? ^^^ == FAIL: test_strcoll_with_diacritic (test.test_locale.TestEnUSCollation) -- Traceback (most recent call last): File /usr/home/haypo/prog/python/default/Lib/test/test_locale.py, line 364, in test_strcoll_with_diacritic self.assertLess(locale.strcoll('\xe0', 'b'), 0) AssertionError: 126 not less than 0 == FAIL: test_strxfrm_with_diacritic (test.test_locale.TestEnUSCollation) -- Traceback (most recent call last): File /usr/home/haypo/prog/python/default/Lib/test/test_locale.py, line 367, in test_strxfrm_with_diacritic self.assertLess(locale.strxfrm('\xe0'), locale.strxfrm('b')) AssertionError: '\xe0' not less than 'b' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16455 ___ -- Added file: http://bugs.python.org/file27970/force_ascii.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16455 ___diff -r 6a6ad09faad2 Python/fileutils.c --- a/Python/fileutils.cMon Nov 12 01:23:51 2012 +0100 +++ b/Python/fileutils.cMon Nov 12 15:33:24 2012 +0100 @@ -4,6 +4,7 @@ #endif #ifdef HAVE_LANGINFO_H +#include locale.h #include langinfo.h #endif @@ -39,6 +40,104 @@ PyObject * #ifdef HAVE_STAT +/* Workaround FreeBSD and OpenIndiana locale encoding issue. On these + operating systems, nl_langinfo(CODESET) announces an alias of the ASCII + encoding, whereas mbstowcs() and wcstombs() functions use the ISO-8859-1 + encoding. The problem is that os.fsencode() and os.fsdecode() use the + Python codec ASCII. For example, if command line arguments are decoded + by mbstowcs() and encoded by os.fsencode(), we get a UnicodeEncodeError + instead of retrieving the original byte string. + + The workaround is enabled if setlocale(LC_CTYPE, NULL) returns C and + nl_langinfo(CODESET) returns ascii. The workaround is not used if + setlocale(LC_CTYPE, NULL) failed, or if nl_langinfo() or CODESET is not + available. + + Values of locale_is_ascii: + + 1: the workaround is used, the ASCII codec is used instead of mbstowcs() + and wcstombs() functions + 0: the workaround is not used + -1: unknown, need to call check_locale_force_ascii() to known the value +*/ +static int locale_force_ascii = -1; + +extern char* _Py_GetLocaleEncoding(void); + +static int +check_locale_force_ascii(void) +{ +#ifdef MS_WINDOWS +return 0; +#else +char *encoding, *loc; +int i; +unsigned char ch; +wchar_t wch; +size_t res; + +return 1; + +loc = setlocale(LC_CTYPE, NULL); +if (loc == NULL || strcmp(loc, C) != 0) { +/* Failed to get the LC_CTYPE locale or it is different than C: + * don't use the workaround. */ +return 0; +} + +encoding = _Py_GetLocaleEncoding(); +if (encoding == NULL) { +/* unknown encoding: consider that the encoding is not ASCII */ +PyErr_Clear(); +return 0; +} + +if (strcmp(encoding, ascii) != 0) { +free(encoding); +return 0; +} +free(encoding); + +/* the locale is not set and nl_langinfo(CODESET) returns ASCII + (or an alias of the ASCII encoding). Check if the locale encoding + is really ASCII. */ +for (i=0x80; i0xff; i++) { +ch = (unsigned char)i; +res = mbstowcs(wch, (char*)ch, 1); +if (res == (size_t)-1) { +/* decoding a non-ASCII character from the locale encoding failed: + the encoding is really ASCII */ +return 0; +} +} +return 1; +#endif
[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)
Martin v. Löwis added the comment: I think the patch will break on Unix systems that don't have uid_t or gid_t types. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16455] sys.getfilesystemencoding() is not the locale encoding on FreeBSD and OpenSolaris when the locale is not set
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16455 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)
Ronald Oussoren added the comment: The patch should work on OSX, although I haven't actually tested it yet. I've verified that sizeof(uid_t) and sizeof(gid_t) are the same for x86_64 and i386, which means SIZEOF_UID_T doesn't have to be added to pymacconfig.h. A smal nit with the patch: it uses long long as a type instead of PY_LONG_LONG -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16442] PATH_MAX vs MAXPATHLEN vs pathconf(..., _PC_PATH_MAX).
Martin v. Löwis added the comment: I don't think that using pathconf is an important part of this issue. Instead, it is more important to deal with ENAMETOOLONG errors. To do so, we should get rid of all stack allocations of arrays with PATH_MAX/MAXPATHLEN size (also because they can consume quite a lot of stack). I agree that it important to scope this issue. You need to determine whether you want it to be a bug fix or a cleanup action. If the issue is fails to build on HP-UX, then all other aspects not relevant to this issue need to be left out, in particular the introduction of new symbolic constants. If the objective is the code clean-up, all versions but 3.4 need to be left out. IOW, -1 on systematic introduction of PY_PATH_MAX to 2.7, 3.2, and 3.3. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16442 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
New submission from Christian Kern: Writing .wav files is limited to a file size of 2 Gib, while the WAV file format itself supports up to 4 Gib. Trying to write a file beyond 2 Gib (e.g. 203 minutes at CD quality (i.e. 44.1 kHz, 2 channels, 16 bit)) will crash at the moment when self._datawritten exceeds 2^31-1 bytes. This is due to the fact that, in method _patchheader, the variable self._datawritten is written with struct.pack('l') (signed long integer) instead of struct.pack('L') (unsigned long integer---which would conform to the WAV file format spefication). patch to wave.py: 476c476 self._file.write(struct.pack('l', self._datalength)) --- self._file.write(struct.pack('L', self._datalength)) 485c485 self._file.write(struct.pack('l', 36 + self._datawritten)) --- self._file.write(struct.pack('L', 36 + self._datawritten)) 487c487 self._file.write(struct.pack('l', self._datawritten)) --- self._file.write(struct.pack('L', self._datawritten)) This patch also patches the _write_header method, which has the same problem (but will lead to a crash only in very rare cases). By the way: _patchheader should be renamed to _patch_header in order to be in harmony with the other function/method names of this module. Attached you'll find a very simple python 2 script which will reproduce the problem. Usage: mkdummywav.py $duration_in_minutes Maybe the problem also occurs at python 3, I don't know. -- components: Extension Modules files: mkdummywav.py messages: 175450 nosy: ckern priority: normal severity: normal status: open title: wave module: wrong integer format type: behavior versions: Python 2.6, Python 2.7 Added file: http://bugs.python.org/file27971/mkdummywav.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
New submission from mike.a: The greeting value is required by SPF, and should be returned by SMTPChannel. This would involve a simple fix by adding self.__greeting to the list of returned values in the status object -- messages: 175451 nosy: mike.a priority: normal severity: normal status: open title: smtpd should return greeting type: enhancement versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
Jesús Cea Avión added the comment: Mike, could you possibly elaborate more?. I don't understand your bug report. BTW, Python 2.6 is open only for security bugfixes. Python 2.7, 3.2 and 3.3 are currently open for regular bugfixes. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16442] PATH_MAX vs MAXPATHLEN vs pathconf(..., _PC_PATH_MAX).
Stefan Krah added the comment: #15835 has a patch specifically for HP-UX. Also see the link in msg171068 for evidence that PATH_MAX is quite a mess on HP-UX. -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16442 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
mike.a added the comment: The greeting value is the HELO/EHLO identity. RFC 4408 (SPF) recommends checking both the mail from domain as well as the HELO identity, so this value is useful and could be passed to proc_message() function (API for doing something useful with this message). Later versions of the code pass the same values, so this is relevant for 2.7, 3.2, and 3.3. -- versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15835] HP-UX build needs to be tweaked to pick up PATH_MAX
Martin v. Löwis added the comment: The patch looks good, please apply. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file27926/posix_uid_gid_conv.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)
Serhiy Storchaka added the comment: I think the patch will break on Unix systems that don't have uid_t or gid_t types. I think defines to int will be used on such systems. As I understand the configure script. A smal nit with the patch: it uses long long as a type instead of PY_LONG_LONG Thank you. Fixed. -- Added file: http://bugs.python.org/file27972/posix_uid_gid_conv_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2005 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
R. David Murray added the comment: Are you asking to have seen_greeting passed in the server.process_message call? That is reasonable. -- components: +email nosy: +barry, r.david.murray versions: +Python 2.6 -Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Library (Lib) -Extension Modules stage: - needs patch versions: +Python 3.2, Python 3.3, Python 3.4 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
mike.a added the comment: David, Yes, that is what I am asking. Thanks, -Mike -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Jesús Cea Avión added the comment: Python 3.x affected too. Python 2.6 is open only for security fixes. 4GB support confirmed: https://en.wikipedia.org/wiki/WAV#Limitations But trying to find a canonical description of the format, I see tons of inconsistencies. For instance http://web.archive.org/web/20080113195252/http://www.borg.com/~jglatt/tech/wave.htm defines chunkSize as long. That is, signed. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
R. David Murray added the comment: On the other hand, it would also be backward incompatible. Can anyone think of a backward compatible way to provide this info? Maybe we could use the new signature object support. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16462] smtpd should return greeting
Changes by R. David Murray rdmur...@bitdance.com: -- versions: +Python 3.4 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16391] add terminator ctor argument to logging.StreamHandlers derived handlers
Vinay Sajip added the comment: I don't understand what you mean. For example, defining def my_handler(*args, **kwargs): terminator = kwargs.pop('terminator', '!\n') h = logging.StreamHandler(*args, **kwargs) h.terminator = terminator return h you can use with a definition of the handler such as 'console': { '()': 'ext://__main__.my_handler', 'stream': 'ext://sys.stdout', 'terminator': '!\n', } or similar. And you can also do something this with your own subclass, instead of a function as per my example. ISTM that using subclasses is the right way to approach this problem; otherwise why would one *ever* use subclasses? I use them when the base class doesn't do exactly what I want, but offers extension points to change its behaviour via subclassing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16391 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16461] wave module: wrong integer format
Christian Kern added the comment: Addendum: 4 Gib file size can only be achieved with unsigned long. Moreover, for numbers 2^31, signed long and unsigned long seem to be the same, so there should arise no problem. (Tested on x86_64 linux) BTW: Writing .wav files could gain performance it there'd be an option for updating the header only at the end of writing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16460] Strange results for floor division (//) with non-integer divisors
Tom Pohl added the comment: Since nobody seems to share my point of view, I give up. :-) Thanks for your support and for working on Python (the best programming language as we all know), Tom -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT
Chromatix added the comment: Actually many people try to compile python on an environment with freestanding C library, so this can be a specific case of that. Is there any issue or thread where compiling python with freestanding headers is discussed? As this relates to that. Shall you remove the defines, please put instructions in the source code to let user know how they can provide their self-invented fstat function to the code. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12082 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15880] os.path.split() and long UNC names
Terry J. Reedy added the comment: I agree. Larry H.'s patch in #5799 was called an enhancement and is explicitly a replacement for splitunc. The latter was deprecated and may disappear in 3.4. -- resolution: - wont fix stage: test needed - committed/rejected status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15835] HP-UX build needs to be tweaked to pick up PATH_MAX
Roundup Robot added the comment: New changeset 5db6d9ddf6e8 by Stefan Krah in branch '3.3': Issue #15835: Define PATH_MAX on HP-UX. http://hg.python.org/cpython/rev/5db6d9ddf6e8 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15835] HP-UX build needs to be tweaked to pick up PATH_MAX
Stefan Krah added the comment: Thanks for reviewing! -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15835 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16458] subprocess.py throw The handle is invalid error on duplicating the STD_INPUT_HANDLE
Changes by Herc Silverstein h...@schrodinger.com: -- nosy: +hercs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16458 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15880] os.path.split() and long UNC names
Larry Hastings added the comment: ISTM that fixing this for 3.x (3? 4?) is worthwhile though. Or did somebody already fix it in 3.x? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15880] os.path.split() and long UNC names
Terry J. Reedy added the comment: Serhiy claims that the commit of Mark's version of your patch in #5799 fixed this in 3.1. Retesting in IDLE, 3.3, Win7: import os d = '//?/e:/python-test/dir' d = os.path.split(d)[0] d '//?/e:/python-test' d = os.path.split(d)[0] d '//?/e:/' d = os.path.split(d)[0] d '//?/e:/' So the splitting ends where Kalle agrees it should. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.
Serhiy Storchaka added the comment: Alexander, do you want to backport r87736 to 2.7? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16137 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9720] zipfile writes incorrect local file header for large files in zip64
Serhiy Storchaka added the comment: Please, review the patches. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9720 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1470548] Bugfix for #1470540 (XMLGenerator cannot output UTF-16)
Serhiy Storchaka added the comment: If nobody has any objections, why not apply this patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1470548 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16451] Remove duplication between slice_indices and compute_slice_indices
Mark Dickinson added the comment: Patch attached. -- keywords: +patch Added file: http://bugs.python.org/file27973/issue16451.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16451 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11362] image/webp missing from mimetypes.py
Changes by Stefan Neufeind python@stefan-neufeind.de: -- nosy: +neufeind ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11362 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14631] Instance methods and WeakRefs don't mix.
Mark Dickinson added the comment: The patch looks okay to me. What does inheriting from 'ref' buy you? This feels a bit strange to me: the way I think of it, the WeakMethod *has* a weakref to the underlying object, rather than *being* a weakref to the underlying object. The __repr__ also seems a bit misleading as a result: o = Object() m = o.some_method WeakMethod(m) weakref at 0x100665ae0; to 'Object' at 0x101115840 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14631 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14631] Instance methods and WeakRefs don't mix.
Antoine Pitrou added the comment: What does inheriting from 'ref' buy you? Hmm, I'm not sure. I thought I'd mimick KeyedRef's inheritance design, plus isinstance(..., weakref.ref) works, and composition would make the object slightly bigger. Other than that, probably nothing. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14631 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16463] test_timeout failure on the RHEL buildbot
New submission from Antoine Pitrou: The RHEL buildbot consistently fails on test_timeout: == FAIL: testConnectTimeout (test.test_timeout.TCPTimeoutTestCase) -- Traceback (most recent call last): File /home/buildbot/buildarea/3.x.coghlan-redhat/build/Lib/test/test_timeout.py, line 222, in testConnectTimeout self._sock_operation(1, 0.001, 'connect', self.addr_remote) File /home/buildbot/buildarea/3.x.coghlan-redhat/build/Lib/test/test_timeout.py, line 126, in _sock_operation self.assertLess(delta, timeout + self.fuzz) AssertionError: 5.0571630001068115 not less than 2.001 According to the build history, the failure appeared in http://buildbot.python.org/all/builders/x86%20RHEL%206%203.3/builds/133 , but the changes look unlikely to be related. Did the setup change? -- assignee: ncoghlan components: Tests keywords: buildbot messages: 175476 nosy: ncoghlan, pitrou priority: high severity: normal status: open title: test_timeout failure on the RHEL buildbot type: behavior versions: Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16463 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
Roundup Robot added the comment: New changeset 48fbdaf3a849 by Victor Stinner in branch 'default': Issue #16416: OS data are now always encoded/decoded to/from http://hg.python.org/cpython/rev/48fbdaf3a849 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
Roundup Robot added the comment: New changeset f3e512b5ffb3 by Victor Stinner in branch 'default': Issue #16416: Fix error handling in _Py_wchar2char() _Py_char2wchar() functions http://hg.python.org/cpython/rev/f3e512b5ffb3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
Roundup Robot added the comment: New changeset 1b97cc71a05e by Victor Stinner in branch 'default': Issue #16416: Fix Misc/NEWS entry, mention Mac OS X http://hg.python.org/cpython/rev/1b97cc71a05e -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
STINNER Victor added the comment: @Serhiy: Thanks for your review, I missed it before my first commit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
Serhiy Storchaka added the comment: Victor, are you going to backport this to 3.3? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16416] Mac OS X: don't use the locale encoding but UTF-8 to encode and decode filenames
STINNER Victor added the comment: Victor, are you going to backport this to 3.3? I'm waiting for the result of the buildbots, and maybe also the fix for the issue #16455 (which has an impact on tests on undecodable bytes). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16416 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10395] new os.path function to extract common prefix based on path components
Changes by Rafik Draoui ra...@rafik.ca: Added file: http://bugs.python.org/file27974/patch10395-3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10395 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11076] Iterable argparse Namespace
Hobs added the comment: Seems like a great idea. `foo(**dict(args))` is very useful. I tested `foo(**dict(iter(o.__dict__.items(` on python 2.7 Mac OSX for my foo and it worked well. -- nosy: +Hobson.Lane ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11076] Iterable argparse Namespace
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11076 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12455] urllib2 forces title() on header names, breaking some requests
Terry J. Reedy added the comment: The comment about urllib.request forcing .title() is consistent with 'Content-Length' and 'Content-Type' in the docs but puzzling and inconsistent given that in 3.3, header names are printed .capitalize()'ed and not .title()'ed and that has_header and get_header *require* the .capitalize() form and reject the .title() form. import urllib.request opener = urllib.request.build_opener() request = urllib.request.Request(http://example.com/;, headers = {Content-Type: application/x-www-form-urlencoded}) opener.open(request, 1.encode(us-ascii)) print(request.header_items(), request.has_header(Content-Type), request.has_header(Content-type), request.get_header(Content-Type), request.get_header(Content-type), sep='\n') [('Content-type', 'application/x-www-form-urlencoded'), ('Content-length', '1'), ('User-agent', 'Python-urllib/3.3'), ('Host', 'example.com')] False True None application/x-www-form-urlencoded Did .title in 2.7 urllib2 request get changed to .capitalize in 3.x urllib.request (without the examples in the doc being changed) or is request inconsistent within itself? Cal did not the 2.7 code exhibiting the problme, but when I add this code in 3.3, the output start as shown. request.add_header('Content-MD5', 'xxx') print(request.header_items()) # [('Content-md5', 'xxx'), ... So is 3.3 sending 'Content-Md5' or 'Content-md5' My guess is the former, as urllib.request has the same single use of .title in .do_open as Cal quoted. The two files also have the same three uses of .capitalize in .add_header, .add_unredirected_header, and .do_request. So it seems that header names are normalized to .capitalize on entry and .title on sending, or something like that. Ugh. Is there any good justification for this? I do not see anything in the doc about headers names being normalized either way or about the requirements of has_/get_header. If the behavior were consistent and the same since forever, then I would say the current docs should be improved and a change would be an enhancement request. Since the behavior seems inconsistent, I am more inclined to think there is a bug. I realize that this message expands the scope of the issue, but it is all about the handing of header names in requests. -- nosy: +terry.reedy versions: +Python 3.4 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12455 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16464] urllib.request: opener not resetting content-length
New submission from Terry J. Reedy: Code based on python-list post by a do-not-wish-to-register urllib user. import urllib.request opener = urllib.request.build_opener() request = urllib.request.Request(http://example.com/;, headers = {Content-Type: application/x-www-form-urlencoded}) print(request.data, '\n', request.header_items()) opener.open(request, 1.encode(us-ascii)) print(request.data, '\n', request.header_items()) opener.open(request, 123456789.encode(us-ascii)) print(request.data, '\n', request.header_items()) None [('Content-type', 'application/x-www-form-urlencoded')] b'1' [('Content-length', '1'), ('Host', 'example.com'), ('User-agent', 'Python-urllib/3.3'), ('Content-type', 'application/x-www-form-urlencoded')] b'123456789' [('Content-length', '1'), ('Host', 'example.com'), ('User-agent', 'Python-urllib/3.3'), ('Content-type', 'application/x-www-form-urlencoded')] The first opener.open adds data and several headers to request, including content-length. The second changes the data but not the content-length. The docs do not say anything about this either way. -- messages: 175485 nosy: orsenthil, terry.reedy priority: normal severity: normal stage: needs patch status: open title: urllib.request: opener not resetting content-length type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16464 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue812369] module shutdown procedure based on GC
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue812369 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6386] importing yields unexpected results when initial script is a symbolic link
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6386 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15480] Drop TYPE_INT64 from marshal in Python 3.4
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15480 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16163] Wrong name in Lib/pkgutil.py:iter_importers
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16163 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16392] import crashes on circular imports in ext modules
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5950] Make zipimport work with zipfile containing comments
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5950 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14228] It is impossible to catch sigint on startup in python code
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14228 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16421] importlib.machinery.ExtensionFileLoader cannot load several modules from the same shared object
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16421 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14260] re.groupindex available for modification and continues to work, having incorrect data inside it
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14260 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14369] make __closure__ writable
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14369 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14373] C implementation of functools.lru_cache
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14373 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14803] Add feature to allow code execution prior to __main__ invocation
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14803 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16457] Allow operator 'getter' methods to take a list and return a tuple
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16457 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16457] Allow operator 'getter' methods to take a list and return a tuple
Raymond Hettinger added the comment: It's unfortunate that the automatic scalar/tuple switchover design doesn't play well with start-args. We have the same issue arising in a number of places (for example, min(*args) isn't happy when args is of length 1). While inconvenient for variable length argument lists, I don't think the proposed solution is clean. As it currently stands, the signature is reasonably simple, easy to explain, and doesn't depend on exact type checks (like %-formatting does with tuple/dict arguments). Instead of contorting the signature for itemgetter(), it would be better if the use case were to be addressed with the existing language features: t = tuple('abcdefghi') for columns in ([], [2], [2,4], [2,4,6]): print(tuple(t[i] for i in columns)) () ('c',) ('c', 'e') ('c', 'e', 'g') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16457 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15223] datetime instances lack __module__ attribute
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15223 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12703] Improve error reporting for packaging.util.resolve_name
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15272] pkgutil.find_loader accepts invalid module names
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15272 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9325] Add an option to pdb/trace/profile to run library module as a script
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9325 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9914] trace/profile conflict with the use of sys.modules[__name__]
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9914 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15376] Refactor the test_runpy walk_package support code into a common location
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15376 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15358] Test pkgutil.walk_packages in test_pkgutil instead of test_runpy
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15577] Real argc and argv in embedded interpreter
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15577 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15403] Refactor package creation support code into a common location
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15403 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com