[issue1268] array unittest problems with UCS4 build
Travis Oliphant added the comment: This issue may be closed. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1268 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1268] array unittest problems with UCS4 build
Changes by Guido van Rossum: -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1268 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Alexandre Vassalotti added the comment: Christian wrote: Alexandre's mangle loop doesn't do the same job as mine. Chars like _ and - aren't removed from the encoding name and the if clauses don't catch for example UTF-8 or ISO-8859-1 only UTF8 or ISO8859-1. That isn't true. My mangler does exactly the same thing as your original one. However, I forgot to add Py_CHARMASK to the calls of tolower() and isalnum() which would cause problems on platforms with signed char. Also he has overseen a PyString_Check in the code repr function. Fixed. We have to get the codecs up and Py_FileSystemEncoding before we can decode the filenames. :( I think that the problem needs much more attention and a proper fix. Maybe adding a global variable, let's say _Py_Codecs_Ready, could be used to notify PyUnicode_DecodeFSDefault that it can use PyUnicode_Decode, instead of relying only on the built-in codecs. That would be much simpler than changing boostrapping process. Here yet another updated patch. The changes are the following: - Add Py_CHARMASK to tolower() and isalnum() calls in PyUnicode_DecodeFSDefault(). - Use PyUnicode_Check(), instead of PyString_Check(), in code_repr(). - Update comments for co_filename and co_name in PyCodeObject struct definition. - Fix a PyString_AS_STRING(co-co_name) instance in compile.c - Replace %S for %U in PyErr_Format() calls for substituting co_name. One more thing, frozen.c needs to be updated. The module data contains a code object with a PyString co_name. However, there is a bug in the imp module (it doesn't detect the encoding from modelines, which cause io.TextIOWrapper to crash) that prevents me from generating the data for frozen.c. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __Index: Python/ceval.c === --- Python/ceval.c (revision 58455) +++ Python/ceval.c (working copy) @@ -767,7 +767,7 @@ lltrace = PyDict_GetItemString(f-f_globals, __lltrace__) != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co-co_filename); + filename = PyUnicode_AsString(co-co_filename); #endif why = WHY_NOT; @@ -2565,7 +2565,7 @@ if (argcount co-co_argcount) { if (!(co-co_flags CO_VARARGS)) { PyErr_Format(PyExc_TypeError, -%S() takes %s %d +%U() takes %s %d %spositional argument%s (%d given), co-co_name, defcount ? at most : exactly, @@ -2599,7 +2599,7 @@ int j; if (keyword == NULL || !PyUnicode_Check(keyword)) { PyErr_Format(PyExc_TypeError, -%S() keywords must be strings, +%U() keywords must be strings, co-co_name); goto fail; } @@ -2622,7 +2622,7 @@ if (j = co-co_argcount + co-co_kwonlyargcount) { if (kwdict == NULL) { PyErr_Format(PyExc_TypeError, - %S() got an unexpected + %U() got an unexpected keyword argument '%S', co-co_name, keyword); @@ -2633,7 +2633,7 @@ else { if (GETLOCAL(j) != NULL) { PyErr_Format(PyExc_TypeError, - %S() got multiple + %U() got multiple values for keyword argument '%S', co-co_name, @@ -2661,7 +2661,7 @@ continue; } PyErr_Format(PyExc_TypeError, - %S() needs keyword-only argument %S, + %U() needs keyword-only argument %S, co-co_name, name); goto fail; } @@ -2671,7 +2671,7 @@ for (i = argcount; i m; i++) { if (GETLOCAL(i) == NULL) { PyErr_Format(PyExc_TypeError, - %S() takes %s %d + %U() takes %s %d %spositional argument%s (%d given), co-co_name, @@ -2699,7 +2699,7 @@ else { if (argcount 0 || kwcount 0) { PyErr_Format(PyExc_TypeError, - %S() takes no arguments (%d given), + %U() takes no arguments (%d given), co-co_name, argcount + kwcount); goto fail; Index: Python/traceback.c === --- Python/traceback.c (revision 58455) +++ Python/traceback.c (working copy) @@ -229,10 +229,10 @@ while (tb != NULL err == 0) { if (depth = limit) { err = tb_displayline(f, - PyString_AsString( + PyUnicode_AsString( tb-tb_frame-f_code-co_filename), tb-tb_lineno, - PyString_AsString(tb-tb_frame-f_code-co_name)); + PyUnicode_AsString(tb-tb_frame-f_code-co_name)); } depth--; tb = tb-tb_next; Index: Python/pythonrun.c === --- Python/pythonrun.c (revision 58455) +++ Python/pythonrun.c (working copy) @@ -867,7 +867,8 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, __file__) == NULL) { - PyObject *f = PyString_FromString(filename); + PyObject *f; + f =
[issue1631171] implement warnings module in C
Brett Cannon added the comment: So the descriptor idea didn't work. Another idea is to have the C code that relies on attributes on warnings that are allowed to change have an initial check for warnings, and if that fails to fall back on C code. That way the module can still be completely self-sufficient while still allowing users to change values from Python code. For instance, take warnings.filters. Initially it can be set to _warnings.filters. But in the C code, where access to the filters list is needed, a check is first done to see if the warnings module has been imported. If so, check for a filters attribute. If it exists, replace the internal list with that one and continue on. If the module is not there, however, use the list stored statically in the module without change. Same idea of the once registry and a similar idea for showwarnings(). _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1631171 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1276] LookupError: unknown encoding: X-MAC-JAPANESE
Changes by Georg Brandl: -- versions: +Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1276 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1114345] Add SSL certificate validation
vila added the comment: I'm planning to do a package for 2.3... Any progress on that package ? I'd like to do the same for python 2.4 and 2.5 as I have a need for it for both versions. I don't know what you call a package though, but I'm willing to learn :) -- nosy: +vila _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1114345 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue961805] Text.edit_modified() fails
Matthias Kievernagel added the comment: Moved my patch from Issue1643641 to this Issue. (duplication was created when moving from SF bugs/patches) Patch to be applied with 'patch -p0' I have also attached a demo where you can test all Text.edit_* functions. Regards, Matthias Kievernagel -- nosy: +mkiever Tracker [EMAIL PROTECTED] http://bugs.python.org/issue961805 editModified.py Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue961805] Text.edit_modified() fails
Changes by Matthias Kievernagel: Tracker [EMAIL PROTECTED] http://bugs.python.org/issue961805 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1643641] Fix Bug 1362475 Text.edit_modified() doesn't work
Matthias Kievernagel added the comment: Moved my patch to Issue961805. (duplication was created when moving from SF bugs/patches) This issue should be closed down. Regards, Matthias Kievernagel _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1643641 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1135] xview/yview of Tix.Grid is broken
Matthias Kievernagel added the comment: Hint: There is also Issue1522587, which contains a large patch (by klappnase) for Tix.Grid addressing xview/yview and several other issues. I do not know if it fixes this issue exactly. Can you take a look at it, ocean-city? Regards, Matthias Kievernagel -- nosy: +mkiever __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1135 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522587] Tix.Grid patch
Changes by Matthias Kievernagel: -- nosy: +mkiever _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522587 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: Alexandre Vassalotti wrote: That isn't true. My mangler does exactly the same thing as your original one. However, I forgot to add Py_CHARMASK to the calls of tolower() and isalnum() which would cause problems on platforms with signed char. I wasn't sure how tolower() reacts on numeric values. The addition of Py_CHARMASK is a good idea. It's a shame stringobject.c doesn't expose its non locale version of tolower() and isalnum(). Maybe adding a global variable, let's say _Py_Codecs_Ready, could be used to notify PyUnicode_DecodeFSDefault that it can use PyUnicode_Decode, instead of relying only on the built-in codecs. That would be much simpler than changing boostrapping process. It still f... up the file names of Python modules that were loaded before the codecs are ready to use. What do you think about this (pseudocode): #if defined(MS_WINDOWS) defined(HAVE_USABLE_WCHAR_T) return PyUnicode_DecodeMBCS(string, replace) #elif defined(__APPLE__) return PyUnicode_DecodeUTF8(string, replace) #else * set __file__ and co_filename to a preliminary value with PyUnicode_DecodeUTF8(string, replace) * Store a pointer and original string in a linked list struct Py_FixFileNames { struct Py_FixFileNames *next; char *string; PyObject *unicode; }; * After the codecs and Py_FileSystemDefaultEncoding are set up in Py_InitializeEx() check the value. If the fs default encoding isn't UTF-8 redo all encodings with the correct encoding. * Free the linked list * From now on use the codecs package, PyUnicode_Decode() and Py_FileSystemDefaultEncoding for every filename #endif Add comments to See Python/bltinmodule.c Py_FileSystemDefaultEncoding and Objects/unicodeobject.c unicode_default_encoding that PyUnicode_DecodeFSDefault depends on the values. It ain't beautiful and fast but we definitely get the right file names after boot strapping and fair file names during boot strapping. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Guido van Rossum added the comment: Only a few modules are involved in the bootstrap. The filename is mostly used to display in the traceback. There is already a fallback in the traceback-printing code that tries to look through sys.path for a file matching the module if it can't open the filename from the code object. So I suggest to do something much simpler -- if the default encoding isn't set yet, use ASCII + replace, and leave it at that -- don't bother fixing these things later. Another thought: when installed, the built-in modules are compiled to byte code by compileall.py, which runs late enough so that the filesystem encoding is known and everything can be done right. I have a question for Alexandre related to frozen.c -- why is there a mode line with an encoding involved in freezing hello.py? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1268] array unittest problems with UCS4 build
Christian Heimes added the comment: Can this be closed now that Travis reverted his patch? Yes, it can be closed. By the way svn.python.org and the anon svn server are down the third time this week. Something is wrong with the server. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1268 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Alexandre Vassalotti added the comment: I have a question for Alexandre related to frozen.c -- why is there a mode line with an encoding involved in freezing hello.py? For some reason which I don't know about, freeze.py tries to read all the modules accessible from sys.path: # collect all modules of the program dir = os.path.dirname(scriptfile) path[0] = dir mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths) The problem is the imp module, which modulefinder uses, does not detect the encoding of the files from the mode-line. This causes TextIOWrapper to crash when it tries to read modules using an encoding other than ASCII or UTF-8. Here an example: import imp imp.find_module('heapq')[0].read() Traceback (most recent call last): ... UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1428-1430: invalid data I probably should open a seperate issue in the tracker for this, though. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1277] mailbox.Maildir: factory not used
New submission from Bernd Wurst: The factory-argument to the constructorof mailbox.Maildir is not used as it should be. First, it's default is set to rfc822.Message instead of MaildirMessage and then, inside the module's code, MaildirMessage is hard-coded as a message constructor. If I need a derived class with custom attributes, I cannot use it. -- components: Extension Modules messages: 56418 nosy: bwurst severity: normal status: open title: mailbox.Maildir: factory not used type: resource usage versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1277 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Alexandre Vassalotti added the comment: I thought of another way to implement PyUnicode_DecodeFSDefault. If Py_FileSystemDefaultEncoding is set, decode with the codecs module, otherwise use UTF-8 + replace. This works because when Py_FileSystemDefaultEncoding is initialized at the end of Py_InitializeEx(), the codecs module is ready to be used. Here's what it looks like: PyObject* PyUnicode_DecodeFSDefault(const char *s) { Py_ssize_t size = (Py_ssize_t)strlen(s); /* During the early bootstrapping process, Py_FileSystemDefaultEncoding can be undefined. If it is case, decode using UTF-8. The following assumes that Py_FileSystemDefaultEncoding is set to a built-in encoding during the bootstrapping process where the codecs aren't ready yet. */ if (Py_FileSystemDefaultEncoding) { return PyUnicode_Decode(s, size, Py_FileSystemDefaultEncoding, replace); } else { return PyUnicode_DecodeUTF8(s, size, replace); } } It is not perfect, since the extra function calls in the codecs module causes test_profile and test_doctest to fail. However, I think this is much simpler that the previous versions. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __Index: Python/ceval.c === --- Python/ceval.c (revision 58455) +++ Python/ceval.c (working copy) @@ -767,7 +767,7 @@ lltrace = PyDict_GetItemString(f-f_globals, __lltrace__) != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co-co_filename); + filename = PyUnicode_AsString(co-co_filename); #endif why = WHY_NOT; @@ -2565,7 +2565,7 @@ if (argcount co-co_argcount) { if (!(co-co_flags CO_VARARGS)) { PyErr_Format(PyExc_TypeError, -%S() takes %s %d +%U() takes %s %d %spositional argument%s (%d given), co-co_name, defcount ? at most : exactly, @@ -2599,7 +2599,7 @@ int j; if (keyword == NULL || !PyUnicode_Check(keyword)) { PyErr_Format(PyExc_TypeError, -%S() keywords must be strings, +%U() keywords must be strings, co-co_name); goto fail; } @@ -2622,7 +2622,7 @@ if (j = co-co_argcount + co-co_kwonlyargcount) { if (kwdict == NULL) { PyErr_Format(PyExc_TypeError, - %S() got an unexpected + %U() got an unexpected keyword argument '%S', co-co_name, keyword); @@ -2633,7 +2633,7 @@ else { if (GETLOCAL(j) != NULL) { PyErr_Format(PyExc_TypeError, - %S() got multiple + %U() got multiple values for keyword argument '%S', co-co_name, @@ -2661,7 +2661,7 @@ continue; } PyErr_Format(PyExc_TypeError, - %S() needs keyword-only argument %S, + %U() needs keyword-only argument %S, co-co_name, name); goto fail; } @@ -2671,7 +2671,7 @@ for (i = argcount; i m; i++) { if (GETLOCAL(i) == NULL) { PyErr_Format(PyExc_TypeError, - %S() takes %s %d + %U() takes %s %d %spositional argument%s (%d given), co-co_name, @@ -2699,7 +2699,7 @@ else { if (argcount 0 || kwcount 0) { PyErr_Format(PyExc_TypeError, - %S() takes no arguments (%d given), + %U() takes no arguments (%d given), co-co_name, argcount + kwcount); goto fail; Index: Python/traceback.c === --- Python/traceback.c (revision 58455) +++ Python/traceback.c (working copy) @@ -229,10 +229,10 @@ while (tb != NULL err == 0) { if (depth = limit) { err = tb_displayline(f, - PyString_AsString( + PyUnicode_AsString( tb-tb_frame-f_code-co_filename), tb-tb_lineno, - PyString_AsString(tb-tb_frame-f_code-co_name)); + PyUnicode_AsString(tb-tb_frame-f_code-co_name)); } depth--; tb = tb-tb_next; Index: Python/pythonrun.c === --- Python/pythonrun.c (revision 58455) +++ Python/pythonrun.c (working copy) @@ -867,7 +867,8 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, __file__) == NULL) { - PyObject *f = PyString_FromString(filename); + PyObject *f; + f = PyUnicode_DecodeFSDefault(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, __file__, f) 0) { Index: Python/import.c === --- Python/import.c (revision 58455) +++ Python/import.c (working copy) @@ -74,10 +74,11 @@ 3040 (added signature annotations) 3050 (print becomes a function) 3060 (PEP 3115 metaclass syntax) - 3070 (PEP 3109 raise changes) + 3070 (PEP 3109 raise changes) +
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: Alexandre Vassalotti wrote: Alexandre Vassalotti added the comment: I thought of another way to implement PyUnicode_DecodeFSDefault. If Py_FileSystemDefaultEncoding is set, decode with the codecs module, otherwise use UTF-8 + replace. This works because when Py_FileSystemDefaultEncoding is initialized at the end of Py_InitializeEx(), the codecs module is ready to be used. Here's what it looks like: That's almost what I had in mind but with two exceptions for __APPLE__ and MS_WINDOWS. For both OS the value of Py_FileSystemDefaultEncoding is hard coded to UTF-8 / MBCS. In your code the method would use PyUnicode_Decode() too early but you can work around the problem with two #if defined. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1268] array unittest problems with UCS4 build
Christian Heimes added the comment: Oh stop, the array module doesn't build for me (Ubuntu Linux, i386, UCS-4 build, rev58458): Modules/arraymodule.c: In function 'array_buffer_getbuf': Modules/arraymodule.c:1815: error: 'Py_buffer' has no member named 'formats' Please replace formats with format in line 1815: view-format = w; Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1268 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: Changes since updated_file_fsenc-5.patch: * Fix for hard coded FS default encoding on Apple and Windows * Added two notes to unicode_default_encoding and Py_FileSystemDefaultEncoding __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __Index: Python/ceval.c === --- Python/ceval.c (revision 58458) +++ Python/ceval.c (working copy) @@ -767,7 +767,7 @@ lltrace = PyDict_GetItemString(f-f_globals, __lltrace__) != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co-co_filename); + filename = PyUnicode_AsString(co-co_filename); #endif why = WHY_NOT; @@ -2565,7 +2565,7 @@ if (argcount co-co_argcount) { if (!(co-co_flags CO_VARARGS)) { PyErr_Format(PyExc_TypeError, -%S() takes %s %d +%U() takes %s %d %spositional argument%s (%d given), co-co_name, defcount ? at most : exactly, @@ -2599,7 +2599,7 @@ int j; if (keyword == NULL || !PyUnicode_Check(keyword)) { PyErr_Format(PyExc_TypeError, -%S() keywords must be strings, +%U() keywords must be strings, co-co_name); goto fail; } @@ -2622,7 +2622,7 @@ if (j = co-co_argcount + co-co_kwonlyargcount) { if (kwdict == NULL) { PyErr_Format(PyExc_TypeError, - %S() got an unexpected + %U() got an unexpected keyword argument '%S', co-co_name, keyword); @@ -2633,7 +2633,7 @@ else { if (GETLOCAL(j) != NULL) { PyErr_Format(PyExc_TypeError, - %S() got multiple + %U() got multiple values for keyword argument '%S', co-co_name, @@ -2661,7 +2661,7 @@ continue; } PyErr_Format(PyExc_TypeError, - %S() needs keyword-only argument %S, + %U() needs keyword-only argument %S, co-co_name, name); goto fail; } @@ -2671,7 +2671,7 @@ for (i = argcount; i m; i++) { if (GETLOCAL(i) == NULL) { PyErr_Format(PyExc_TypeError, - %S() takes %s %d + %U() takes %s %d %spositional argument%s (%d given), co-co_name, @@ -2699,7 +2699,7 @@ else { if (argcount 0 || kwcount 0) { PyErr_Format(PyExc_TypeError, - %S() takes no arguments (%d given), + %U() takes no arguments (%d given), co-co_name, argcount + kwcount); goto fail; Index: Python/traceback.c === --- Python/traceback.c (revision 58458) +++ Python/traceback.c (working copy) @@ -229,10 +229,10 @@ while (tb != NULL err == 0) { if (depth = limit) { err = tb_displayline(f, - PyString_AsString( + PyUnicode_AsString( tb-tb_frame-f_code-co_filename), tb-tb_lineno, - PyString_AsString(tb-tb_frame-f_code-co_name)); + PyUnicode_AsString(tb-tb_frame-f_code-co_name)); } depth--; tb = tb-tb_next; Index: Python/pythonrun.c === --- Python/pythonrun.c (revision 58458) +++ Python/pythonrun.c (working copy) @@ -867,7 +867,8 @@ return -1; d = PyModule_GetDict(m); if (PyDict_GetItemString(d, __file__) == NULL) { - PyObject *f = PyString_FromString(filename); + PyObject *f; + f = PyUnicode_DecodeFSDefault(filename); if (f == NULL) return -1; if (PyDict_SetItemString(d, __file__, f) 0) { Index: Python/import.c === --- Python/import.c (revision 58458) +++ Python/import.c (working copy) @@ -74,10 +74,11 @@ 3040 (added signature annotations) 3050 (print becomes a function) 3060 (PEP 3115 metaclass syntax) - 3070 (PEP 3109 raise changes) + 3070 (PEP 3109 raise changes) + 3080 (PEP 3137 make __file__ and __name__ unicode) . */ -#define MAGIC (3070 | ((long)'\r'16) | ((long)'\n'24)) +#define MAGIC (3080 | ((long)'\r'16) | ((long)'\n'24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the @@ -652,7 +653,7 @@ /* Remember the filename as the __file__ attribute */ v = NULL; if (pathname != NULL) { - v = PyString_FromString(pathname); + v = PyUnicode_DecodeFSDefault(pathname); if (v == NULL) PyErr_Clear(); } @@ -983,7 +984,7 @@ PySys_WriteStderr(import %s # directory %s\n, name, pathname); d = PyModule_GetDict(m); - file = PyString_FromString(pathname); + file = PyUnicode_DecodeFSDefault(pathname); if (file == NULL) goto error; path = Py_BuildValue([O], file); Index: Python/compile.c === --- Python/compile.c (revision 58458) +++ Python/compile.c (working copy) @@ -1247,7 +1247,7 @@
[issue1114345] Add SSL certificate validation
Bill Janssen added the comment: See the SSL package on PyPI. Should work on 2.3, 2.4, and 2.5. Bill On 10/14/07, vila [EMAIL PROTECTED] wrote: vila added the comment: I'm planning to do a package for 2.3... Any progress on that package ? I'd like to do the same for python 2.4 and 2.5 as I have a need for it for both versions. I don't know what you call a package though, but I'm willing to learn :) -- nosy: +vila _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1114345 _ _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1114345 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1268] array unittest problems with UCS4 build
Guido van Rossum added the comment: Oh stop, the array module doesn't build for me (Ubuntu Linux, i386, UCS-4 build, rev58458): Modules/arraymodule.c: In function 'array_buffer_getbuf': Modules/arraymodule.c:1815: error: 'Py_buffer' has no member named 'formats' Please replace formats with format in line 1815: view-format = w; Done. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1268 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Guido van Rossum added the comment: This looks promising. I'm working on the freeze issue. Once I get that working I'll check this in. Thanks Alexandre and Christian for all your hard work!!! __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Guido van Rossum added the comment: The problem is the imp module, which modulefinder uses, does not detect the encoding of the files from the mode-line. This causes TextIOWrapper to crash when it tries to read modules using an encoding other than ASCII or UTF-8. Here an example: import imp imp.find_module('heapq')[0].read() Traceback (most recent call last): ... UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1428-1430: invalid data I can't reproduce this. Can you open a separate issue? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1428-1430: invalid data I can't reproduce this. Can you open a separate issue? It breaks for me with the same error message on Ubuntu Linux, i386, UCS-4 build and locale de_DE.UTF-8. (io.TextIOWrapper object at 0xb7c9158c, '/home/heimes/dev/python/py3k/Lib/heapq.py', ('.py', 'U', 1)) imp.find_module('heapq')[0].read() Traceback (most recent call last): File stdin, line 1, in module File /home/heimes/dev/python/py3k/Lib/io.py, line 1224, in read res += decoder.decode(self.buffer.read(), True) File /home/heimes/dev/python/py3k/Lib/codecs.py, line 291, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1428-1430: invalid data imp.find_module('heapq')[0].readline() '# -*- coding: Latin-1 -*-\n' imp.find_module('heapq')[0].encoding 'UTF-8' __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: This looks promising. I'm working on the freeze issue. Once I get that working I'll check this in. Thanks Alexandre and Christian for all your hard work!!! You're welcome. Does the patch qualify me for Misc/ACKS? :) I'm going to work on the basestring patch after you have committed the changes. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Christian Heimes added the comment: I found two minor bugs in the fix. In Modules/posixmodule.c the tmpnam() and tempnam() methods return a PyString instance. Please change line 5373 and 5431 to use PyUnicode_DecodeFSDefault(). Index: Modules/posixmodule.c === --- Modules/posixmodule.c (Revision 58461) +++ Modules/posixmodule.c (Arbeitskopie) @@ -5370,7 +5370,7 @@ #endif if (name == NULL) return PyErr_NoMemory(); -result = PyString_FromString(name); +result = PyUnicode_DecodeFSDefault(name); free(name); return result; } @@ -5428,7 +5428,7 @@ Py_XDECREF(err); return NULL; } -return PyString_FromString(buffer); +return PyUnicode_DecodeFSDefault(buffer); } #endif __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1272] Decode __file__ and co_filename to unicode using fs default
Guido van Rossum added the comment: This looks promising. I'm working on the freeze issue. Once I get that working I'll check this in. Thanks Alexandre and Christian for all your hard work!!! You're welcome. Does the patch qualify me for Misc/ACKS? :) Yes, and also Alexandre. :-) I'm going to work on the basestring patch after you have committed the changes. The commit may have to wait a bit; I'm finding some problems on OSX when the directory in which I'm building has a unicode character in it. (Now, svn has severe problems with this as well, and so far it looks like all the tests run; but still, it's disturbing.) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1272 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1278] imp.find_module() ignores -*- coding: Latin-1 -*-
New submission from Christian Heimes: imp.find_module() returns an io.TextIOWrapper instance first value. The encoding of the TextIOWrapper isn't set from a -*- coding: Latin-1 -*- line. import imp imp.find_module(heapq) (io.TextIOWrapper object at 0xb7c8f50c, '/home/heimes/dev/python/py3k/Lib/heapq.py', ('.py', 'U', 1)) imp.find_module(heapq)[0].read() Traceback (most recent call last): File stdin, line 1, in module File /home/heimes/dev/python/py3k/Lib/io.py, line 1224, in read res += decoder.decode(self.buffer.read(), True) File /home/heimes/dev/python/py3k/Lib/codecs.py, line 291, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1428-1430: invalid data imp.find_module(heapq)[0].encoding 'UTF-8' imp.find_module(heapq)[0].readline() '# -*- coding: Latin-1 -*-\n' -- components: Interpreter Core messages: 56431 nosy: tiran severity: normal status: open title: imp.find_module() ignores -*- coding: Latin-1 -*- type: behavior versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1278 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com