[issue1298] Support for z/OS and EBCDIC.
Lauri Alanko added the comment: How do you measure importance? Z/OS is not important to many people in the world, but to those to whom it is important, it is _very_ important, in a very tangible way. It was certainly important enough for someone to port Python to it. :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1298 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue602345] option for not writing .py[co] files
Georg Brandl added the comment: Since the PEP is now withdrawn, I updated Neal's patch to the trunk and added the env variable as well as the sys module value, including documentation. -- priority: low - normal Added file: http://bugs.python.org/file8567/no-pyc-flag.diff Tracker [EMAIL PROTECTED] http://bugs.python.org/issue602345 Index: Python/pythonrun.c === --- Python/pythonrun.c (Revision 58468) +++ Python/pythonrun.c (Arbeitskopie) @@ -72,6 +72,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */ int Py_NoSiteFlag; /* Suppress 'import site' */ +int Py_ReadOnlyBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ int Py_FrozenFlag; /* Needed by getpath.c */ int Py_UnicodeFlag = 0; /* Needed by compile.c */ @@ -172,6 +173,8 @@ Py_VerboseFlag = add_flag(Py_VerboseFlag, p); if ((p = Py_GETENV(PYTHONOPTIMIZE)) *p != '\0') Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); + if ((p = Py_GETENV(PYTHONNOPYCFILES)) *p != '\0') + Py_ReadOnlyBytecodeFlag = add_flag(Py_ReadOnlyBytecodeFlag, p); interp = PyInterpreterState_New(); if (interp == NULL) Index: Python/import.c === --- Python/import.c (Revision 58468) +++ Python/import.c (Arbeitskopie) @@ -951,8 +951,11 @@ if (Py_VerboseFlag) PySys_WriteStderr(import %s # from %s\n, name, pathname); - if (cpathname) - write_compiled_module(co, cpathname, mtime); + if (cpathname) { + PyObject *ro = PySys_GetObject(readonly_bytecode); + if (ro == NULL || !PyObject_IsTrue(ro)) + write_compiled_module(co, cpathname, mtime); + } } m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname); Py_DECREF(co); Index: Python/sysmodule.c === --- Python/sysmodule.c (Revision 58468) +++ Python/sysmodule.c (Arbeitskopie) @@ -1128,6 +1128,9 @@ v = Py_BuildValue((ssz), CPython, branch, svn_revision); PyDict_SetItemString(sysdict, subversion, v); Py_XDECREF(v); +PyDict_SetItemString(sysdict, readonly_bytecode, + v = PyBool_FromLong(Py_ReadOnlyBytecodeFlag)); +Py_XDECREF(v); /* * These release level checks are mutually exclusive and cover * the field, so don't get too fancy with the pre-processor! Index: Include/pydebug.h === --- Include/pydebug.h (Revision 58468) +++ Include/pydebug.h (Arbeitskopie) @@ -17,6 +17,7 @@ PyAPI_DATA(int) Py_UnicodeFlag; PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; PyAPI_DATA(int) Py_DivisionWarningFlag; +PyAPI_DATA(int) Py_ReadOnlyBytecodeFlag; /* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed, on the command line, and is used in 2.2 by ceval.c to make all / divisions true divisions (which they will be in 3.0). */ Index: Doc/library/sys.rst === --- Doc/library/sys.rst (Revision 58468) +++ Doc/library/sys.rst (Arbeitskopie) @@ -457,6 +457,17 @@ implement a dynamic prompt. +.. data:: readonly_bytecode + + If this is true, Python won't try to write ``.pyc`` or ``.pyo`` files on the + import of source modules. This value is initially set to ``True`` or ``False`` + depending on the ``-R`` command line option and the ``PYTHONNOPYCFILES`` + environment variable, but you can set it yourself to control bytecode file + generation. + + .. versionadded:: 2.6 + + .. function:: setcheckinterval(interval) Set the interpreter's check interval. This integer value determines how often Index: Modules/main.c === --- Modules/main.c (Revision 58468) +++ Modules/main.c (Arbeitskopie) @@ -40,7 +40,7 @@ static int orig_argc; /* command line options */ -#define BASE_OPTS 3c:dEhim:OQ:StuUvVW:xX? +#define BASE_OPTS 3c:dEhim:OQ:RStuUvVW:xX? #ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS @@ -71,27 +71,30 @@ -O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\ -OO: remove doc-strings in addition to the -O optimizations\n\ -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ +-R : don't write .py[co] files on import; also PYTHONNOPYCFILES=x\n\ -S : don't imply 'import site' on initialization\n\ -t
[issue1263] PEP 3137 patch - str8/str comparison should return false
Guido van Rossum added the comment: I've committed the half of this patch that doesn't break any tests: the changes to codecs.c and structmember.c. Committed revision 58551. I'm seeking help getting the remaining unit tests to pass. (Thanks Thomas for the enumeration of the test failures!) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1280] PEP 3137: Make PyString's indexing and iteration return integers
Changes by Guido van Rossum: -- assignee: - gvanrossum nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1280 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1297] pyconfig.h not compatible with MS VC++ Express Edition
Amaury Forgeot d'Arc added the comment: I found that BaseTsd.h is part of the Windows SDK, which is not included in the Express Edition. It can be installed separately. OTOH, the python core still compiles without the #include basetsd.h (using VC++ 2005 Express Edition). What about other compilers? What is this file needed for? -- nosy: +amaury.forgeotdarc __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1297 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Guido van Rossum added the comment: I will take this. -- assignee: brett.cannon - gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1161] Garbled chars in offending line of SyntaxError traceback
Guido van Rossum added the comment: There were some seriously broken things with exception reporting, most of which I seem to have fixed. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1161 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1151] TypeError: expected string, bytes found instead of KeyboardInterrupt
Guido van Rossum added the comment: There were some seriously broken things with exception reporting, most of which I seem to have fixed. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1151 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1298] Support for z/OS and EBCDIC.
Guido van Rossum added the comment: FYI, I checked the moderation queue for python-dev and didn't find your message. You might want to resend. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1298 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1263] PEP 3137 patch - str8/str comparison should return false
Brett Cannon added the comment: Attached is a patch to fix test_compile. Simple fix of turning an empty string into ``str8('')``. Added file: http://bugs.python.org/file8573/fix_test_compile.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ fix_test_compile.diff Description: Binary data ___ 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 -*-
Changes by Guido van Rossum: -- resolution: - fixed status: open - closed __ 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
[issue1263] PEP 3137 patch - str8/str comparison should return false
Brett Cannon added the comment: The file I just uploaded is unicode-string-eq-false-all-r4.patch with the codecs.c and structmember.c parts of the patch removed. -- nosy: +brett.cannon Added file: http://bugs.python.org/file8572/r4-revised.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ r4-revised.patch Description: Binary data ___ 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 -*-
Christian Heimes added the comment: The bug was fixed in r58553 together with http://bugs.python.org/issue1267. Please close this bug. __ 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
[issue1267] Py3K cannot run as ``python -S``
Guido van Rossum added the comment: Committed revision 58553 (with minor tweaks only). Thanks! -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1302] Fixes for profile/cprofile
New submission from Christian Heimes: The patch fixes the output for profile and cProfile. Another patch from Alexandre and me added additional calls to the UTF-8 codec. -- components: Library (Lib) messages: 56569 nosy: gvanrossum, tiran severity: normal status: open title: Fixes for profile/cprofile versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1302 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1280] PEP 3137: Make PyString's indexing and iteration return integers
Guido van Rossum added the comment: Checked in. I addressed some of your XXX'es, left others in (sre needs a serious checkup for compatibility with bytes). Committed revision 58552. -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1280 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: runpy is failing because pkgutil is failing because it is giving compile() part of a source file instead of the entire thing:: Traceback (most recent call last): File /Users/drifty/Dev/python/3.x/pristine/Lib/runpy.py, line 97, in _run_module_as_main loader, code, fname = _get_module_details(mod_name) File /Users/drifty/Dev/python/3.x/pristine/Lib/runpy.py, line 82, in _get_module_details code = loader.get_code(mod_name) File /Users/drifty/Dev/python/3.x/pristine/Lib/pkgutil.py, line 275, in get_code self.code = compile(source, self.filename, 'exec') File /Users/drifty/Dev/python/3.x/pristine/Lib/tokenize.py, line 2 UR''': single3prog, 'UR': double3prog, ^ IndentationError: unexpected indent That bad line is the first line in the 'source' variable being passed to compile(). So somewhere the beginning of the source file is being chopped up. On 10/19/07, Christian Heimes [EMAIL PROTECTED] wrote: Christian Heimes added the comment: I don't have a Mac at my disposal any more. :( Can you attach the output of the failing tests to the bug report? Maybe I can be of assistance. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: Brett Cannon wrote: Brett Cannon added the comment: It looks like the file object returned by imp.find_module() has its read position WAY too far forward (at least on OS X). That's strange. It should never read more than 2 lines of a file. I don't understand how it could happen. char * PyTokenizer_FindEncoding(FILE *fp) { struct tok_state *tok; char *p_start=NULL, *p_end=NULL; if ((tok = PyTokenizer_FromFile(fp, NULL, NULL, NULL)) == NULL) { rewind(fp); return NULL; } while(((tok-lineno = 2) (tok-done == E_OK))) { PyTokenizer_Get(tok, p_start, p_end); } rewind(fp); return tok-encoding; } __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: runpy is failing because pkgutil is failing because it is giving compile() part of a source file instead of the entire thing:: Traceback (most recent call last): File /Users/drifty/Dev/python/3.x/pristine/Lib/runpy.py, line 97, in _run_module_as_main loader, code, fname = _get_module_details(mod_name) File /Users/drifty/Dev/python/3.x/pristine/Lib/runpy.py, line 82, in _get_module_details code = loader.get_code(mod_name) File /Users/drifty/Dev/python/3.x/pristine/Lib/pkgutil.py, line 275, in get_code self.code = compile(source, self.filename, 'exec') File /Users/drifty/Dev/python/3.x/pristine/Lib/tokenize.py, line 2 UR''': single3prog, 'UR': double3prog, ^ IndentationError: unexpected indent That bad line is the first line in the 'source' variable being passed to compile(). So somewhere the beginning of the source file is being chopped up. Could you please comment out the PyTokenizer_FindEncoding(fp) call in Python/import.c to check if it is related to it? That's the only change (I can think of) that may be related to the problem. I always rewind the fp in the function but it may not work on Mac. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: It looks like the file object returned by imp.find_module() has its read position WAY too far forward (at least on OS X). Re-opening. -- status: closed - open __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: It's unrelated to the problem but Parser/tokenizer.c:1619 has a minor bug. while(((tok-lineno = 2) (tok-done == E_OK))) { PyTokenizer_Get(tok, p_start, p_end); } (tok-lineno 2) is sufficient. See line 516 Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: I don't have a Mac at my disposal any more. :( Can you attach the output of the failing tests to the bug report? Maybe I can be of assistance. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1303] adapt str8 constructor to bytes constructor
Changes by Brett Cannon: -- nosy: +brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1303 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1303] adapt str8 constructor to bytes constructor
Changes by Brett Cannon: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1303 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: Yeah, I just noticed this as well. is it definitely this change? On 10/19/07, Guido van Rossum [EMAIL PROTECTED] wrote: Guido van Rossum added the comment: FWIW, on Mac I get six failures (all these pass on Linux): test_cmd_line test_inspect test_modulefinder test_pyclbr test_quopri test_runpy __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1263] PEP 3137 patch - str8/str comparison should return false
Brett Cannon added the comment: Attached a fix for test_format. It was testing string interpolation on both str8 and str and using a str for the comparison. Since string interpolation is going away for str8 once it becomes bytes I just removed the testing of str8. The failures I know of left are: test_modulefinder test_sqlite test_str test_struct test_subprocess Added file: http://bugs.python.org/file8574/fix_test_format.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ fix_test_format.diff Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: OK, for some reason, when PyTokenizer_FindEncoding() is called and the resulting file is big enough, it starts off with a seek position (according to TextIOWrapper.tell()) of 4096. That happens to be exactly half the size of the buffer used by io. But I am not sure what the magical size is as creating a file of 4095, 4096, and 4097 bytes does not trigger this bug. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: Nope, didn't do it. I also checked using gdb a few minutes ago and ftell() was reporting a position of 0 all they way back to PyObject_MethodCall(). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1179] [CVE-2007-4965] Integer overflow in imageop module
Guido van Rossum added the comment: Neal, didn't you say you had a fix for this? -- nosy: +nnorwitz __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1179 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: 58557 as the fix. Yes, it was stupid on OS X's part and I was lucky to just think of the possible solution. Basically OS X does not like it when you do stuff with a file pointer but then poke around with the file descriptor. That means that when PyTokenizer_FindEncoding() seeked on the file pointer it was not being picked up by the the file descriptor that the file pointer represented. This suggests that perhaps we should standardize on file pointers or file descriptors in Python to prevent something like this from happening again. -- assignee: gvanrossum - brett.cannon status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: OK, I think I might have a solution, and it is really stupid. I will run the unit test suite to see if it really fixes everything. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: Brett Cannon wrote: Brett Cannon added the comment: OK, for some reason, when PyTokenizer_FindEncoding() is called and the resulting file is big enough, it starts off with a seek position (according to TextIOWrapper.tell()) of 4096. That happens to be exactly half the size of the buffer used by io. But I am not sure what the magical size is as creating a file of 4095, 4096, and 4097 bytes does not trigger this bug. Maybe rewind() doesn't do what is should do? Could you replace the rewind() calls with fseek(fd, 0, 0)? w/o the rewind() calls in PyTokenizer_FindEncoding I'm getting an error in my new test: Traceback (most recent call last): File Lib/test/test_imp.py, line 66, in module test_main() File Lib/test/test_imp.py, line 62, in test_main ImportTests, File /home/heimes/dev/python/py3k/Lib/test/test_support.py, line 541, in run_unittest _run_suite(suite) File /home/heimes/dev/python/py3k/Lib/test/test_support.py, line 524, in _run_suite raise TestFailed(err) test.test_support.TestFailed: Traceback (most recent call last): File Lib/test/test_imp.py, line 50, in test_issue1267 self.assertEqual(fd.tell(), 0) AssertionError: 4096 != 0 The number is looking familiar, isn't it? :) Is it the default buffer size on Unix? Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: I've made a short unit tests which tests a large file with and w/o -*- coding: -*-. It passes on Linux. Added file: http://bugs.python.org/file8575/py3k_test_issue1267.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __Index: Lib/test/test_imp.py === --- Lib/test/test_imp.py (revision 58554) +++ Lib/test/test_imp.py (working copy) @@ -44,6 +44,18 @@ fd = imp.find_module(heapq)[0] self.assertEqual(fd.encoding, iso-8859-1) +def test_issue1267(self): +fd, filename, info = imp.find_module(pydoc) +self.assertEqual(fd.encoding, iso-8859-1) +self.assertEqual(fd.tell(), 0) +self.assertEqual(fd.readline(), '#!/usr/bin/env python\n') + +fd, filename, info = imp.find_module(tokenize) +self.assertEqual(fd.encoding, utf-8) +self.assertEqual(fd.tell(), 0) +self.assertEqual(fd.readline(), 'Tokenization help for Python programs.\n') + + def test_main(): test_support.run_unittest( LockTests, ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Guido van Rossum added the comment: OK, I think I might have a solution, and it is really stupid. I will run the unit test suite to see if it really fixes everything. Here's keeping my fingers crossed. I do note that the new code still leaks the encoding string which is malloc'ed in PyTokenizer_FindEncoding but never freed by call_find_module. BTW, the test_inspect failure I saw was shallow; I'd renamed the parent directory and the failure was due to the wrong filename being baked into the .pyc file. The other 5 failures are all related to the issue you are chasing here. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: I checked in your `` 2`` change and plugged a memory leak since you were not freeing the struct tok_state. Checked in r58555. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: On 10/19/07, Christian Heimes [EMAIL PROTECTED] wrote: Christian Heimes added the comment: Brett Cannon wrote: This suggests that perhaps we should standardize on file pointers or file descriptors in Python to prevent something like this from happening again. rewind() it used couple of times in the Python code. Have you checked if the other calls are safe? No. I am still rather frustrated that was the problem. The only reason I feel safe with this solution is that the file pointer is not directly used except by _fileio to get the file descriptor. I would not trust this if the file pointer and file descriptor had intertwined uses. But I would trust rewind() if the file pointer is used the entire time. Thx for finding the bug :) Great work! Thanks. I just wish this whole ordeal had not been necessary (filed a bug report with Apple in hopes that this can be prevented for someone else). I can see why some people prefer to hack on PyPy, IronPython, or Jython instead of dealing with the joys of C. =) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Guido van Rossum added the comment: FWIW, on Mac I get six failures (all these pass on Linux): test_cmd_line test_inspect test_modulefinder test_pyclbr test_quopri test_runpy __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: Brett Cannon wrote: This suggests that perhaps we should standardize on file pointers or file descriptors in Python to prevent something like this from happening again. rewind() it used couple of times in the Python code. Have you checked if the other calls are safe? Thx for finding the bug :) Great work! Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1303] adapt str8 constructor to bytes constructor
New submission from Georg Brandl: This makes the str8 constructor accept the same kinds of types as the bytes constructor. I had to fix instances of str8(abc) to str8(babc) to make tests pass again. The only remaining failure should be test_str -- the string test suite must be thoroughly redesigned to fit all three string-like types. -- assignee: gvanrossum components: Interpreter Core files: str_constructor.diff keywords: py3k messages: 56572 nosy: georg.brandl, gvanrossum severity: normal status: open title: adapt str8 constructor to bytes constructor versions: Python 3.0 Added file: http://bugs.python.org/file8570/str_constructor.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1303 __Index: Objects/stringobject.c === --- Objects/stringobject.c (Revision 58552) +++ Objects/stringobject.c (Arbeitskopie) @@ -3020,16 +3020,149 @@ static PyObject * string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyObject *x = NULL; - static char *kwlist[] = {object, 0}; + PyObject *x = NULL, *it; + PyObject *(*iternext)(PyObject *); + const char *encoding = NULL; + const char *errors = NULL; + PyObject *new = NULL; + Py_ssize_t i, size; + static char *kwlist[] = {object, encoding, errors, 0}; if (type != PyString_Type) return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, |O:str8, kwlist, x)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, |Oss:str8, kwlist, x, +encoding, errors)) return NULL; - if (x == NULL) + if (x == NULL) { + if (encoding != NULL || errors != NULL) { + PyErr_SetString(PyExc_TypeError, + encoding or errors without sequence + argument); + return NULL; + } return PyString_FromString(); - return PyObject_Str(x); + } + + if (PyUnicode_Check(x)) { + /* Encode via the codec registry */ + if (encoding == NULL) { + PyErr_SetString(PyExc_TypeError, + string argument without an encoding); + return NULL; + } + new = PyCodec_Encode(x, encoding, errors); + if (new == NULL) + return NULL; + /* XXX(gb): must accept bytes here since codecs output bytes + at the moment */ + if (PyBytes_Check(new)) { + PyObject *str; + str = PyString_FromString(PyBytes_AsString(new)); + Py_DECREF(new); + if (!str) + return NULL; + return str; + } + if (!PyString_Check(new)) { + PyErr_Format(PyExc_TypeError, +encoder did not return a str8 +object (type=%.400s), +Py_Type(new)-tp_name); + Py_DECREF(new); + return NULL; + } + return new; + } + + /* If it's not unicode, there can't be encoding or errors */ + if (encoding != NULL || errors != NULL) { + PyErr_SetString(PyExc_TypeError, + encoding or errors without a string argument); + return NULL; + } + + /* Use the modern buffer interface */ + if (PyObject_CheckBuffer(x)) { + Py_buffer view; + if (PyObject_GetBuffer(x, view, PyBUF_FULL_RO) 0) + return NULL; + new = PyString_FromStringAndSize(NULL, view.len); + if (!new) + goto fail; + if (PyBuffer_ToContiguous(((PyStringObject *)new)-ob_sval, + view, view.len, 'C') 0) + goto fail; + PyObject_ReleaseBuffer(x, view); + return new; + fail: + Py_XDECREF(new); + PyObject_ReleaseBuffer(x, view); + return NULL; + } + + /* For the iterator version, create a string object and resize as needed. */ + /* XXX(gb): is 64 a good value? also, optimize this if length is known */ + size = 64; + new = PyString_FromStringAndSize(NULL, size); + if (new == NULL) + return NULL; + + /* XXX Optimize this if the arguments is a list, tuple */ + + /* Get the iterator */ + it = PyObject_GetIter(x); + if (it == NULL) +
[issue1263] PEP 3137 patch - str8/str comparison should return false
Changes by Brett Cannon: Removed file: http://bugs.python.org/file8543/unnamed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1263 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1302] Fixes for profile/cprofile
Christian Heimes added the comment: Sure there is a patch ... well it's ... *uhm* ... it's hidden under your bed. O:-) Added file: http://bugs.python.org/file8569/py3k_profile_fix.patches __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1302 __ py3k_profile_fix.patches Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
Raghuram Devarakonda added the comment: I tested cmd.py on Linux and two things (including the one reported by OP) looked odd to me. 1) CTRL-D produces a message *** Unknown syntax: EOF. 2) CTRL-C produces a KeyboardInterrupt exception and the session terminates. I am attaching a patch that changes the behaviour to a more typical one (at least, in IMHO). It terminates the session on CTRL-D and it just ignores CTRL-C. Both of these can be overridden, if required. If the patch is accepted, a doc change would be required in addition to the change in doc string. I tested the patch on Linux and Windows. -- nosy: +draghuram Added file: http://bugs.python.org/file8568/cmd.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1294 __Index: Lib/cmd.py === --- Lib/cmd.py (revision 58221) +++ Lib/cmd.py (working copy) @@ -130,6 +130,9 @@ line = raw_input(self.prompt) except EOFError: line = 'EOF' +except KeyboardInterrupt: +line = 'KeyboardInterrupt' + else: self.stdout.write(self.prompt) self.stdout.flush() @@ -403,3 +406,13 @@ for col in range(len(texts)): texts[col] = texts[col].ljust(colwidths[col]) self.stdout.write(%s\n%str( .join(texts))) + +def do_EOF(self, args): +default implementation for EOF +self.stdout.write('\n') +return True + +def do_KeyboardInterrupt(self, args): +default implementation for CTRL-C +self.stdout.write('\n') +return False ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1304] py3k compilation on Windows
New submission from Amaury Forgeot d'Arc: This patch is needed to have py3k compile on win32, since the introduction of bytes_methods.c. Also, use the recently re-added md5module.c and sha1module.c, because a precompiled openssl library is difficult to obtain on Windows. Note: I tested only with VS2005. I will watch the buildbots to verify that compilation actually succeeds. -- components: Build, Windows files: win32build.diff messages: 56573 nosy: amaury.forgeotdarc severity: normal status: open title: py3k compilation on Windows versions: Python 3.0 Added file: http://bugs.python.org/file8571/win32build.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1304 __ win32build.diff Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1302] Fixes for profile/cprofile
Brett Cannon added the comment: There is no patch. =) -- assignee: - gvanrossum keywords: +py3k nosy: +brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1302 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1302] Fixes for profile/cprofile
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1302 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1161] Garbled chars in offending line of SyntaxError traceback
Eduardo Padoan added the comment: Can't reproduce this error anymore with revision 58472. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1161 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1151] TypeError: expected string, bytes found instead of KeyboardInterrupt
Eduardo Padoan added the comment: Can't reproduce this error anymore with revision 58472. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1151 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1290] xml.dom.minidom not able to handle utf-8 data
Raghuram Devarakonda added the comment: The fact that the problem occurs only from the command line and not when run from a script indicates that the real issue is in trying to print the object. Sure enough, if you modify the script to do repr(mydom.firstChild.childNodes), it gets the same problem. So the issue may have some thing to do with how the object is constructed in repr(). I don't have time right now to dig deeper but the parser itself may not have any encoding/decoding issues (apart of ability to print these high level objects). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1290 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1298] Support for z/OS and EBCDIC.
Guido van Rossum added the comment: How do you measure importance? Z/OS is not important to many people in the world, but to those to whom it is important, it is _very_ important, in a very tangible way. It was certainly important enough for someone to port Python to it. :) But is it important enough to cause a lot of work for the maintainers of Python, not just once (reviewing your mega-patch) but also in the future (making sure that the Z/OS support doesn't break)? We have accepted mega-patches for minority OS'es in the past, and our experience has unfortunately been that the contributors of such patches inevitable lose interest and the Python core developers are stuck with maintaining the patch -- or ripping it out, which is just as much work but at least promises that there will be no more work related to this issue in the future. I strongly recommend an alternative: the Z/OS community should maintain the patch set themselves. That way the burden of keeping it working is to those who benefit. It also makes it possible to decide not to upgrade to a newer version of Python because there aren't enough benefits. This is done for example by Nokia for its port to S60. The character set of EBCDIC is a superset of the character set of ASCII. In fact CP1047, the variant used on z/OS, has the same character set as Latin-1. Only the encoding is completely different. And there's the crux -- too much code (not just in the core but also in the library and in 3rd party code) assumes that the ASCII *encoding* is used in 8-bit strings. Breaking this will break tons of stuff. Glancing at your code it seems that you haven't tried the socket module or the higher-level internet modules to contact web servers on the internet... __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1298 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294] Management of KeyboardInterrupt in cmd.py
BULOT added the comment: Hello, Here is my patch for cmd.py Regards stephbul Added file: http://bugs.python.org/file8566/cmd.py.keyboardinterrupt.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1294 __--- backuo/cmd.py 2007-10-19 13:54:25.0 +0200 +++ cmd.py 2007-10-19 14:19:54.0 +0200 @@ -130,6 +130,13 @@ line = raw_input(self.prompt) except EOFError: line = 'EOF' +except KeyboardInterrupt: +self.stdout.write('\nare you sure you want to exit? y/n ') +answer ='' +while (answer != 'y') (answer != 'n'): +answer = raw_input() +if answer == 'y': +exit(0) else: self.stdout.write(self.prompt) self.stdout.flush() ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue602345] option for not writing .py[co] files
Tom Tanner added the comment: Is there likely to be any action on this. We can get issues with the creation of .pyc files due to our build setup. We can get situations where we run builds in parallel on 2 different architectures. Our build is set up so that anything generated by compilers end up in individual architecture specific directories, but we cannot do this with python. We are also using clearmae, which has its own build avoidance features, which get thoroughly confused by the generation of these files) End result is one of 1) We get corrupt .pyc files 2) The build breaks 3) We rebuild things we don't need to. We'd be very grateful for a way of suppressing the generation of .pyc files completely. -- nosy: +thosrtanner Tracker [EMAIL PROTECTED] http://bugs.python.org/issue602345 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: PyTokenizer_FindEncoding() is the culprit. If I comment it out in Python/import.c:call_find_module(), and thus just use the system encoding, runpy works again. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1284] typo in lib doc 7.3.2.1 MaildirMessage
Georg Brandl added the comment: Thanks, fixed in r58545, r58546 (2.5). -- nosy: +georg.brandl resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1284 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1299] distutils.sysconfig is not cross-platform compatible
Nick added the comment: I'll look into it this weekend. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1299 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1298] Support for z/OS and EBCDIC.
Lauri Alanko added the comment: The character set of EBCDIC is a superset of the character set of ASCII. In fact CP1047, the variant used on z/OS, has the same character set as Latin-1. Only the encoding is completely different. As a non-ASCII platform, z/OS is certainly challenging for people used to modern conventions, and that is exactly why a familiar and easy-to-use tool like Python is so valuable there. As for viability, there are some obvious difficulties with Python's handling of source encodings, but as long as you restrict yourself to the ASCII _character set_ in your source code, the vast majority of things seem to work fine with my patch. There are more details in my mail to python-dev, which doesn't seem to have appeared yet. I'm not a subscriber, so it's probably pending moderation somewhere. (I hope The list address accepts e-mail from non-members is still correct information.) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1298 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Christian Heimes added the comment: Brett Cannon wrote: Thanks. I just wish this whole ordeal had not been necessary (filed a bug report with Apple in hopes that this can be prevented for someone else). I can see why some people prefer to hack on PyPy, IronPython, or Jython instead of dealing with the joys of C. =) The bug is rather strange. I would have imagined that fseek() and rewind() are using the file descriptor internally. It's more than weird that an operation on the file handler doesn't affect the file descriptor. I wonder how they were able to manage it ... IronPython might be fun but I've hacked PythonDotNet. You get the worst from the C, .NET/C# and Mono together. Debugging is fun when you have to do multiple turns with two debuggers and one of the debuggers is partly broken. :[ __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1267] Py3K cannot run as ``python -S``
Brett Cannon added the comment: Thanks, Guido. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1267 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1297] pyconfig.h not compatible with MS VC++ Express Edition
Nick added the comment: MS VC++ 2005 Express Edition __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1297 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com