[issue10080] Py_Initialize crashes when stdout has been redirected with freopen

2010-10-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

It looks very similar to issue6501.
Can you check if setting the environment variable
PYTHONIOENCODING=cp1252
solves the problem?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6417] multiprocessing Process examples: print and getppid

2010-10-12 Thread Georg Brandl

Changes by Georg Brandl :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6417] multiprocessing Process examples: print and getppid

2010-10-12 Thread Sandro Tosi

Sandro Tosi  added the comment:

Thanks Michael for checking it, this bug can be closed then, since all the 
points mentioned were already fixed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue10080] Py_Initialize crashes when stdout has been redirected with freopen

2010-10-12 Thread Mitchell Stokes

New submission from Mitchell Stokes :

I have Python embedded in a C/C++ program, and I'm trying to redirect stdout to 
a text file. Since I'm trying to get rid of the console, I want C and Python 
stdout going to the text file (so, not sys.stdout = open('log.txt', 'w')). To 
this end, I used freopen() like so:

freopen("log.txt", "w", stdout);

to redirect stdout in C. However, when using Python 3.1, I get the following 
error:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

followed by a crash (Runtime Error). I think this is somewhat related to this 
bug: http://bugs.python.org/issue1415

I've attached a sample program that illustrates the problem. I compiled it with:

gcc -o py_main.exe py_main.c -IC:\Python31\include -LC:\Python31\libs -lpython31

I had someone test the sample program on Linux, and it worked fine there, so I 
think it's a Windows issue.

--
components: Windows
files: py_main.c
messages: 118502
nosy: Mitchell.Stokes
priority: normal
severity: normal
status: open
title: Py_Initialize crashes when stdout has been redirected with freopen
type: crash
versions: Python 3.1
Added file: http://bugs.python.org/file19212/py_main.c

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10079] idlelib for Python 3 with Guilherme Polo GSoC enhancements

2010-10-12 Thread Bruce Sherwood

New submission from Bruce Sherwood :

It is proposed to incorporate the work of Guilherme Polo in the 2009
Google Summer of Code into idlelib. Polo's enhancements have been
extensively tested for a year through being included with VPython.

Here is a description from NEWS.txt:

In December 2008 David Scherer created an alternative version
of IDLE to fix some long-standing problems. In the 2009 Google
Summer of Code Guilherme Polo continued this work, assisted by
Bruce Sherwood. Important new fixes and features include:

 * A configuration preference that permits writing and running
   test programs from the editor without having to save the file
   (you're warned upon quitting whether to save).

 * Bringing the shell window forward in case of an error (because
   novices often failed to realize why their program had stopped).
 * A revert plug-in (FileRevert.py).

 * Unreliable and slow termination of user program on Windows;
   now you can re-run without first closing the graphics window.

 * Missing preferences and other menus on Macintosh.

 * Use any port for RPC server, so multiple instances of VIDLE
   can run at the same time without interference.

Polo submitted patches at the end of the summer of 2009, found at
code.google.com/p/google-summer-of-code-2009-python/downloads/list
This was for the Python 2.X series.

Because the mechanism was not clear for getting these patches
into the version of IDLE distributed with Python, the patched
version has been distributed with VPython (vpython.org) with
the name VIDLE to attempt to avoid confusion with IDLE. It is
installed into site-packages.

In October 2010 Bruce Sherwood manually applied Polo's patches
to the idlelib found at 
   svn.python.org/projects/python/tags/r312/Lib/idlelib 

In addition to applying Polo's patches, the new code uses the new
dot addressing of modules (e.g. from . import PyShell). Except for
having to change one absolute address in the use of __import__ in
PyShell.py, this version can work either in Python31/Lib/idlelib or
in Python31/Lib/site-packages/vidle. This VIDLE will be included in
the installer for VPython for Python 3.

--
components: IDLE
files: vidle20101012.diff
keywords: patch
messages: 118501
nosy: Bruce.Sherwood
priority: normal
severity: normal
status: open
title: idlelib for Python 3 with Guilherme Polo GSoC enhancements
type: feature request
versions: Python 3.1
Added file: http://bugs.python.org/file19211/vidle20101012.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-12 Thread Brian Curtin

Brian Curtin  added the comment:

Fixed test_mailbox in r85401.
Fixed test_marshal in r85402.
Fixed test_bz2 in r85403.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10071] Should not release GIL while running RegEnumValue

2010-10-12 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Hirokazu, could you run Python in a debugger and figure out exactly which line 
crashes and what the error is?  I'm curious.

If we make this change, the same change should be applied to RegEnumKey, etc., 
since the RegEnumKey docs contain similar language.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-10-12 Thread Brian Curtin

Brian Curtin  added the comment:

Fixed test_gzip in r85400.

--
resolution:  -> accepted

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6417] multiprocessing Process examples: print and getppid

2010-10-12 Thread Michael Newman

Michael Newman  added the comment:

The example is working correctly for:
Python 3.2a3 (r32a3:85355, Oct 10 2010, 17:11:45) [MSC v.1500 32 bit (Intel)] 
on win32

# First test:
C:\mike>c:\Python32\python.exe s2.py
main line
module name: __main__
parent process: 2360
process id: 1584
function f
module name: __main__
parent process: 1584
process id: 3588
hello bob

# Second test (run it again to see process IDs change)
C:\mike>c:\Python32\python.exe s2.py
main line
module name: __main__
parent process: 2360
process id: 5904
function f
module name: __main__
parent process: 5904
process id: 1560
hello bob

# For reference:
C:\mike>c:\Python32\python.exe
Python 3.2a3 (r32a3:85355, Oct 10 2010, 17:11:45) [MSC v.1500 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getppid()
2360

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

r85398

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

test_runpy fails also on Python 3.2.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

r85393 introduced a regression in test_runpy of Python 2.7.

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10071] Should not release GIL while running RegEnumValue

2010-10-12 Thread Brian Curtin

Brian Curtin  added the comment:

Some of your submission appears to have gotten lost (I saw it via email).
Below is the patch you proposed. I haven't experienced this crash on my 
machines, but the solution seems fine to me.


# I sometimes experienced crash of test_changing_value(test_winreg)
# on release27-maint. It happens when 2 threads calls PyEnumValue and
# PySetValue simultaneously. And I could stop it by following patch.
# I'll attach the stack trace of crash.

Index: PC/_winreg.c
===
--- PC/_winreg.c(revision 85344)
+++ PC/_winreg.c(working copy)
@@ -1219,7 +1219,6 @@
}

while (1) {
-Py_BEGIN_ALLOW_THREADS
rc = RegEnumValue(hKey,
  index,
  retValueBuf,
@@ -1228,7 +1227,6 @@
  &typ,
  (BYTE *)retDataBuf,
  &retDataSize);
-Py_END_ALLOW_THREADS

if (rc != ERROR_MORE_DATA)
break;
@@ -1577,9 +1575,7 @@
if (subKey == NULL)
return NULL;
}
-Py_BEGIN_ALLOW_THREADS
rc = RegSetValue(hKey, subKey, REG_SZ, str, len+1);
-Py_END_ALLOW_THREADS
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc, "RegSetValue");
Py_INCREF(Py_None);

--
components: +Windows
nosy: +brian.curtin, stutzbach
stage:  -> patch review
type:  -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

> Is it always correct to decode a filename with the locale encoding
> on Unix?

Do you know something better than the locale encoding? I don't.

> Can’t each filesystem have its own encoding?

Yes, but how do you get the encoding of each filesystem? I think that few or no 
application support such case without mojibake. Backup programs can use the 
"raw" (bytes) API of Python 3 to avoid all encoding issues.

--

As wrote R. David Murray, read issue #9992 if you would like to know more about 
this problem and the different proposed solutions. I voted for removal of 
PYTHONFSENCODING which fix most issues.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

Patch version 4:
 - Add segfault.c to pythoncore.vcproj
 - Remove #error "nope" (I used it for debug purpose)
 - Don't include  on Windows

This version works on Windows.

--
Added file: http://bugs.python.org/file19210/segfault_handler-4.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1503] test_xmlrpc is still flakey

2010-10-12 Thread Ralf Schmitt

Ralf Schmitt  added the comment:

The tests now pass, but the underlying issue hasn't been fixed!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

> It should be tested at least on a wide build and ...

Done: it works correctly for non-BMP characters in narrow and wide builds.

Eg. in wide build with U+10 character in the path:
-
$ ./python bla.py 
Fatal Python error: segmentation fault

Traceback (most recent call first):
  File "/home/SHARE/SVN/py3k\U0010/Lib/ctypes/__init__.py", line 486 in 
string_at
  File "bla.py", line 2 in 
Segmentation fault
Abandon
-

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-12 Thread kai zhu

kai zhu  added the comment:

done ;p
added separate unicode read, write, and readwrite test cases (which all pass)

keep in mind my issue is specific to truncation of carriage return (imo a  
priority for py3k migration).  i think this can b resolved by python 3.2

more general unicode issues should b raised in separate bug reports.

--
Added file: 
http://bugs.python.org/file19209/socket.makefile.with.unittest.v3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file17717/segfault_handler-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file17507/segfault_handler.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +dmalcolm

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

Updated example:
--
$ ./python Lib/test/crashers/recursive_call.py
Fatal Python error: segmentation fault

Traceback (most recent call first):
  File "Lib/test/crashers/recursive_call.py", line 12 in 
  File "Lib/test/crashers/recursive_call.py", line 12 in 
  File "Lib/test/crashers/recursive_call.py", line 12 in 
...
  File "Lib/test/crashers/recursive_call.py", line 12 in 
  File "Lib/test/crashers/recursive_call.py", line 12 in 
  File "Lib/test/crashers/recursive_call.py", line 15 in 
Segmentation fault
--

SIGSEGV catched in gdb:
--
$ gdb -args ./python Lib/test/crashers/recursive_call.py 
...
(gdb) run
Starting program: /home/SHARE/SVN/py3k/python 
Lib/test/crashers/recursive_call.py

Program received signal SIGSEGV, Segmentation fault.
0x080614e1 in _PyObject_DebugMalloc (nbytes=24) at Objects/obmalloc.c:1398
1398return _PyObject_DebugMallocApi(_PYMALLOC_OBJ_ID, nbytes);
(gdb)
--

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8863] Segfault handler: display Python backtrace on segfault

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

New version of the patch:
 - use more standard function names (_Py_initsegfault => _Py_InitSegfault)
 - use "#ifdef HAVE_SIGACTION" to support system without sigaction(): fallback 
to signal()
 - usage of the alternative stack is now optional (#ifdef HAVE_SIGALTSTACK)
 - don't call _PyUnicode_AsString() (encode unicode to utf-8) because it 
allocates memory and it does complex operation which may fail: implement a new 
simple function to write a unicode string to a FILE* object with 
ascii+backslashreplace
 - display the function name in the backtrace (but don't display function depth)
 - _Py_FiniSegfault(): restore the old signal handlers before freeing the 
alternative stack memory (and not the opposite)

I only tested the patch on Linux with a narrow build. It should be tested at 
least on a wide build and on Windows.

I tested my patch on all Lib/test/crashers/*.py: all segfaults are replaced by 
nice Python tracebacks.

If you debug a Python program in gdb, gdb stops at the first SIGSEGV (before 
calling the signal handler).

I didn't tested how the signal handler behaves if it raises a new fault (SIGFPE 
or SIGSEGV). It is supposes to stop immediatly.

In the worst case, my patch introduces an infinite loop and the program eats 
all CPU time (and consume maybe a lot of memory?) instead of exiting 
immediatly. Especially, segfault_handler() doesn't ensure that there is no loop 
in the frame linked list. A possible solution is to fix a limit of the maximum 
depth (eg. only display first 100 frames and finished with "...").

--
Added file: http://bugs.python.org/file19208/segfault_handler-3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Done for all branches that are maintained.

--
resolution: remind -> fixed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Retro

Changes by Retro :


--
resolution: fixed -> remind

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Retro

Changes by Retro :


--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Retro

Retro  added the comment:

Please commit this fix to the trunk, as well as to the Python 2.5, Python 2.6, 
and Python 2.7 branches. Thank you.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

r85395.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10078] Documentation: 'Postive' should be 'Positive'

2010-10-12 Thread Retro

New submission from Retro :

There's a typo in the docs. Please follow 
http://docs.python.org/py3k/library/string.html#format-specification-mini-language
 and find the below text, and fix the word 'Postive' to 'Positive', indicated 
between >>> and <<<:

'g' 
General format. For a given precision p >= 1, this rounds the number to p 
significant digits and then formats the result in either fixed-point format or 
in scientific notation, depending on its magnitude.

The precise rules are as follows: suppose that the result formatted with 
presentation type 'e' and precision p-1 would have exponent exp. Then if -4 <= 
exp < p, the number is formatted with presentation type 'f' and precision 
p-1-exp. Otherwise, the number is formatted with presentation type 'e' and 
precision p-1. In both cases insignificant trailing zeros are removed from the 
significand, and the decimal point is also removed if there are no remaining 
digits following it.

>>>Postive<<< and negative infinity, positive and negative zero, and nans, are 
>>>formatted as inf, -inf, 0, -0 and nan respectively, regardless of the 
>>>precision.

A precision of 0 is treated as equivalent to a precision of 1.

--
assignee: d...@python
components: Documentation
messages: 118482
nosy: Retro, d...@python
priority: normal
severity: normal
status: open
title: Documentation: 'Postive' should be 'Positive'
versions: 3rd party, Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 
3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

r85392.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7140] imp.new_module does not function correctly if the module is returned from a function and used directly

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Rebroken in r85392. See #10068.

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6612] 'import site' fails when called from an unlinked directory

2010-10-12 Thread STINNER Victor

STINNER Victor  added the comment:

Fixed in 3.2 (r85386+r85387+r85389), 2.7 (r85390), 3.1 (r85391).

Thanks labrat for your patch. I added you to Misc/ACKS.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10077] Python 3.1: site error is not logged

2010-10-12 Thread STINNER Victor

New submission from STINNER Victor :

If the site module fails, the error is not logged because of a bug in 
initsite(). The problem is that PyFile_WriteString() does nothing if an error 
occurred.

 - Edit Lib/site.py to add "raise Exception('xxx')" at the beginning of main()
 - Run ./python
 - (no error is logged)

In verbose mode, only the exception is logged, without the first line:

  'import site' failed; traceback:

Attached patch fixes both issues.

--

This issue is specific to Python 3.1:
 - Python 2.7 and 3.2 consider site error as a fatal error 
 - Python 2.6 doesn't have the bug because PyFile_WriteString() write the 
message even if an error occurred

--
components: Library (Lib)
files: site_error.patch
keywords: patch
messages: 118478
nosy: haypo
priority: normal
severity: normal
status: open
title: Python 3.1: site error is not logged
versions: Python 3.1
Added file: http://bugs.python.org/file19207/site_error.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10069] 2to3 crash in fix_urllib.py

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

r85388.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Sridhar Ratnakumar

Changes by Sridhar Ratnakumar :


--
nosy: +toddw

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

On 2010-10-12, at 11:49 AM, Ned Deily wrote:

> And what is libpyxpcom.dylib?  

Likely PyXPCOM
https://developer.mozilla.org/en/PyXPCOM

> As Ronald says, this is almost certainly a 3rd-party extension module problem.

Ok, I've made a note for Todd (current developer for PyXPCOM) here,
http://bugs.activestate.com/show_bug.cgi?id=88165#c5

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Therefore, I propose we remove the Py_REFCNT == 1 guard in
> module_dealloc, and simply leave as an open bug that modules will clear 
> their dictionaries on deallocation.

Yes, I think it's the best solution. People can easily copy the dict if they 
want to keep it around after the module gets destroyed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10068] global objects created in some module are not destroyed when last reference to that module is released

2010-10-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Tricky. I think the only way to do this properly is to call _PyModule_Clear 
when the dict is destroyed. However, there's no good way to flag a dictionary 
as a "module" dict. Therefore, I propose we remove the Py_REFCNT == 1 guard in 
module_dealloc, and simply leave as an open bug that modules will clear their 
dictionaries on deallocation. Thoughts?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You can check accept4() presence by adding it to the AC_CHECK_FUNCS macro in 
configure.in around line 2553, and add the corresponding HAVE_ACCEPT4 lines in 
pyconfig.h.in. Then run "autoconf" and you will have access to a HAVE_ACCEPT4 
constant when accept4() exists.

By the way, you shouldn't use C++-style comments ("// ..."), because some C 
compilers refuse them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3873] Unpickling is really slow

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed in r85384.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Vetoshkin Nikita

Vetoshkin Nikita  added the comment:

Thanks! I can see the problem now, but I think checking should be done like 
this:
>>> fcntl.fcntl(c, fcntl.F_GETFD) & fcntl.FD_CLOEXEC
0
>>> fcntl.fcntl(s, fcntl.F_GETFD) & fcntl.FD_CLOEXEC
1
and with accept4() call I've got flag set:
>>> fcntl.fcntl(c, fcntl.F_GETFD) & fcntl.FD_CLOEXEC
1
>>> fcntl.fcntl(s, fcntl.F_GETFD) & fcntl.FD_CLOEXEC
1

Don't know how to properly check if accept4 is available.

Second attempt - dropping flags from sock_type should be done on Python level 
in socket.py and I don't quite like idea to check if SOCK_CLOEXEC is in locals 
every time.

--
Added file: http://bugs.python.org/file19206/issue7523_py3k_accept4.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10076] Regex objects became uncopyable in 2.5

2010-10-12 Thread Michael Shields

Michael Shields  added the comment:

Here's the patch.  I updated the test case and release notes also.

I'm a Google employee, so this patch is covered by whatever usual copyright 
arrangement we have with the PSF.

--
keywords: +patch
Added file: http://bugs.python.org/file19205/copy-pattern.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10076] Regex objects became uncopyable in 2.5

2010-10-12 Thread Michael Shields

New submission from Michael Shields :

For many years now, the sre module has provided __copy__ and __deepcopy__ 
modules that raise an exception ("cannot copy this pattern object") by default, 
with an #ifdef to enable their implementations.  Until Python 2.5, these were 
simply unused.  Since then, deepcopying these objects fails, instead of falling 
back to the default implementation.

Python 2.4.6 (#1, Nov 23 2009, 03:28:22)
[GCC 4.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> x = [re.compile('.*')]
>>> import copy
>>> copy.deepcopy(x)
[<_sre.SRE_Pattern object at 0x7f3e9411e168>]

Python 2.6.2 (r262:71600, Jul 24 2009, 17:29:21)
[GCC 4.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> x = [re.compile('.*')]
>>> import copy
>>> copy.deepcopy(x)
Traceback (most recent call last):
 File "", line 1, in 
 File "/usr/grte/v1/k8-linux/lib/python2.6/copy.py", line 162, in deepcopy
   y = copier(x, memo)
 File "/usr/grte/v1/k8-linux/lib/python2.6/copy.py", line 228, in _deepcopy_list
   y.append(deepcopy(a, memo))
 File "/usr/grte/v1/k8-linux/lib/python2.6/copy.py", line 173, in deepcopy
   y = copier(memo)
TypeError: cannot deepcopy this pattern object

I'll attach a patch against 2.7 to correct this.

--
components: Library (Lib)
messages: 118469
nosy: Michael.Shields
priority: normal
severity: normal
status: open
title: Regex objects became uncopyable in 2.5
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

>> I don't think this can work. You may have to write code like
>>
>> if sys.version_info >= (3,):
>>   try:
>> some_code()
>>   except Exception, e:
>> pass
>>
>> (i.e. not use the "as" syntax), because it otherwise won't parse on
>> Python 2. Hence, one has to rely on 2to3 fixing it, even though
>> it will never be run on Python 2.
> 
> I assume it should be "if sys.version_info < (3,):" since that looks
> like Python 2 code, and that'll work with the above revised suggestion.

No, I meant this as stated. Suppose you would write (as you apparently
expected me to)

if sys.version_info >= (3,):
   try:
 some_code()
   except Exception as e:
 pass

then the entire module (and not just this if-block) will fail to import
in Python 2. Therefore, you must not use syntax that is exclusively
Python 3 in an if-python3 block if you want to continue to use the code
in Python 2 (and if you don't want to use the code in Python 2, you
don't need the if block).

Then you run the code (as I originally posted) through 2to3, and out
you get the block that will then get executed in Python 3.
Therefore, it is necessary to convert the code that is meant for
Python 3 with 2to3 still.

>> While I now understand what is being requested, I still fail to see
>> the rationale. In my applications of 2to3, I never look at the generated
>> code, so it doesn't bother me at all if print gets another pairs of
>> brackets, or if redundant (but dead) import statements are inserted.
> 
> Wow.  We live in different mental worlds.  It would not have occurred
> to me to take the 2to3 output as more than helpful suggestions.  Some
> to be applied straight (like 'except' syntax), other to maybe apply
> but also look closer at nearby code.

So please reconsider. Using that approach will allow you to have a
single source code for Python 2 and Python 3. You write it so that
it works fine on Python 2, and let 2to3 generate the Python 3 version,
which you then run unmodified. For that to work, it's important that
any modifications that 2to3 won't do will be done *before* invoking
2to3, and these modifications must therefore then work with Python 2
as well (albeit possibly in a block that is never executed on Python 2).

If, at some point, you are then ready to burn the bridges (i.e. give
up Python 2 support), you run 2to3 once, and start removing all
ugliness that you had collected during the transition phase.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread Philip Jenvey

Philip Jenvey  added the comment:

Another option is to wrap the operations in a try/except. When a TypeError is 
raised have it throw a new TypeError with an improved error message and the 
original chained to it

--
nosy: +pjenvey

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The proposed test case doesn't test a lot, IMHO. It would be better if it sent 
binary from one end and received unicode on the other end, or vice-versa (with 
explicit encoding and errors, preferably).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10075] Get session cache stats from SSLContext

2010-10-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10075] Get session cache stats from SSLContext

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've renamed the method to session_stats() and commited the patch in r85383.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread shadikka

shadikka  added the comment:

To clarify my original point, I'm for making an explicit error message for 
that, definitely not for any silent failure or automatic string conversion.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The accept() issue is the following: the socket created by accept() (in 
Lib/socket.py) will formally inherit its parent's `type` attribute (including 
any SOCK_NONBLOCK and SOCK_CLOEXEC flags).

However, the underlying Linux socket is created by the accept() system call, 
which doesn't inherit flags as mentioned in the aforementioned man page. 
Therefore, the Python socket gives the wrong information about the socket's 
real flags.

This can be witnessed quickly:

>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM | socket.SOCK_CLOEXEC)
>>> s.bind(("", 0))
>>> s.getsockname()
('0.0.0.0', 34634)
>>> s.listen(5)
>>> c, a = s.accept()
   # Here, just start a "telnet" or "nc" session from another term
>>> import fcntl
>>> fcntl.fcntl(s, fcntl.F_GETFD)
1
>>> fcntl.fcntl(c, fcntl.F_GETFD)
0
>>> fcntl.fcntl(c, fcntl.F_GETFD) & fcntl.FD_CLOEXEC
0
>>> c.type & socket.SOCK_CLOEXEC
524288


The quick solution would be to mask out these flags when creating the Python 
socket in accept(). A better solution might be to inherit these flags by using 
the accept4() system call when possible (this is useful especially for 
SOCK_CLOEXEC, of course).


Apart from that, the patch looks ok, but it would be nice to test that at least 
the underlying socket is really in non-blocking mode, like is done in 
NonBlockingTCPTests.testSetBlocking.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Rafe Kettler  added the comment:

Double spaced after the sentence ending periods.

--
Added file: http://bugs.python.org/file19204/ftplib-patch.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Changes by Rafe Kettler :


Removed file: http://bugs.python.org/file19203/ftplib-patch.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

I’d be in favor of type checking here, but I know I’m in the minority.  I’m 
very much not in favor of making code less readable (“& 3”).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

Looks good to me.  Before committing, spaces after full stops should be doubled.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Changes by Rafe Kettler :


Added file: http://bugs.python.org/file19203/ftplib-patch.txt

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Changes by Rafe Kettler :


Removed file: http://bugs.python.org/file19201/ftplib-patch.rst

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Changes by Rafe Kettler :


--
keywords: +patch
Added file: http://bugs.python.org/file19202/ftplib-patch.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Rafe Kettler

Rafe Kettler  added the comment:

I've drafted up a patch. For those of you who don't want to read the diff, it 
changes all references to FTP reply codes with short explanations of what they 
do. Also, in the docs for retrlines() and nlst() the commands LIST, NLST, and 
MLSD are explained.

Attached is the patch.

--
Added file: http://bugs.python.org/file19201/ftplib-patch.rst

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I would also like to note the following curiosity:

>>> calendar.isleap("%d")
False

I still don't think there is anything worth fixing here, but we can consider 
replacing year % 4 == 0 predicate with year & 3 == 0 which will change the 
error raised by isleap("2004") from

TypeError: not all arguments converted during string formatting

to 

TypeError: unsupported operand type(s) for &: 'str' and 'int'

I am not sure if the later is much clearer than the former once you consider 
obfuscated year & 3 == 0 showing up in the backtrace compared to a clear year % 
4 == 0 test.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Vetoshkin Nikita

Vetoshkin Nikita  added the comment:

Made an attempt to port lekma's patch to py3k-trunk. No (logical) changes 
needed.

Don't know about accept4() issue. As I saw in Qt sources, they ifdef'ed CLOEXEC 
by default on file descriptors. Don't think it's acceptable :) in this 
particular case. So, @Antoine, what do you say?

--
nosy: +nvetoshkin
Added file: http://bugs.python.org/file19200/issue7523_py3k.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Ned Deily

Ned Deily  added the comment:

And what is libpyxpcom.dylib?  As Ronald says, this is almost certainly a 
3rd-party extension module problem.

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10075] Get session cache stats from SSLContext

2010-10-12 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This patch adds a method to query the session cache statistics from an SSL 
context. See 
http://www.openssl.org/docs/ssl/SSL_CTX_set_session_cache_mode.html# for more 
info.

--
components: Library (Lib)
files: sslstats.patch
keywords: patch
messages: 118455
nosy: giampaolo.rodola, janssen, jcea, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Get session cache stats from SSLContext
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file19199/sslstats.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

[I got failed issue tracker submission, trying again...]

>> How about this phrasing: “Make 2to3 fixers not touch code in a
>> block starting with ’if sys.version >= '3'’“
>> (and hexversion, version_info, you get the idea)?

Right, almost... it doesn't need to be flexible, it only needs to be
documented for 2to3.  So it also doesn't need to handle the varions
version variables - if e.g. version_info is easiest for 2to3, it need
only handle that.  I've been posting with routine avoidance of testing
versions instead of features (learned from javascript frustration:-)
but that concern was misplaced here.

But it should be "if sys.version {either < or >=} '3':", and it should
not touch the else: block either.  Just trust that the programmer has
written correct version's code for each block, and parse one of the
blocks to pick up whatever info 2to3 needs to process the rest of the
python file.

So...

> I don't think this can work. You may have to write code like
> 
> if sys.version_info >= (3,):
>   try:
> some_code()
>   except Exception, e:
> pass
> 
> (i.e. not use the "as" syntax), because it otherwise won't parse on
> Python 2. Hence, one has to rely on 2to3 fixing it, even though
> it will never be run on Python 2.

I assume it should be "if sys.version_info < (3,):" since that looks
like Python 2 code, and that'll work with the above revised suggestion.

> So any scheme of skipping code must be opt-in.

Fair enough, if it's a 2to3 option which to obey whatever "skip some
code" hack is defined.  That's the same 2to3 command line for a lot of
files, instead of different commmand lines for different files.

Unless we're still talking past each other - if the example code will
never run on Python 2 as you say, there's no reason not to fix syntax
problems like the above.  It's fixing things like bytes vs str which
takes more thought.

> While I now understand what is being requested, I still fail to see
> the rationale. In my applications of 2to3, I never look at the generated
> code, so it doesn't bother me at all if print gets another pairs of
> brackets, or if redundant (but dead) import statements are inserted.

Wow.  We live in different mental worlds.  It would not have occurred
to me to take the 2to3 output as more than helpful suggestions.  Some
to be applied straight (like 'except' syntax), other to maybe apply
but also look closer at nearby code.

Indeed, one of my early 2to3 experiences led to a bug in python 3 code
which I'm now discussing in comp.lang.python.  Also my internal bug
detector zooms in on ((foo)) when I read Python code - I'm seeing code
where something was apparently left out, maybe an inner comma to make it
a tuple.

-- 
Hallvard

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10049] Add a "no-op" (null) context manager to contextlib

2010-10-12 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Are you sure that this is useful enough to warrant inclusion in the standard 
lib?  I don't know of anyone else who has used the same idiom.  It seems crufty 
to me -- something that adds weight (mental burden and maintenance effort) 
without adding much value. I don't know that anyone actually needs this.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10067] itertools' docs put izip_longest in the "terminating on the shortest input sequence" section

2010-10-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10067] itertools' docs put izip_longest in the "terminating on the shortest input sequence" section

2010-10-12 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I saw that when I put in in. 
It doesn't fit the overall category
but it does belong in the same general
grouping and the notes make the semantics clear,
so there is no harm in it and I like the current
presentation better than the alternatives.

--
resolution:  -> wont fix

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

It is not impossible that this is a bug in python, but IMHO pretty unlikely, it 
is way more likely to be a bug in a 3th-party extension.

BTW. This issue is very likely to languish unless you add a way to reproduce 
the issue (and preferably without Komodo).

If you do have a reliable way to reproduce the issue you could try using a 
debug build of python (--with-pydebug) to gather more information.

--
assignee: ronaldoussoren -> nobody
nosy: +nobody

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9003] urllib.request and http.client should allow certificate checking

2010-10-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file19189/unnamed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10049] Add a "no-op" (null) context manager to contextlib

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

Because hardcoding a particular condition into a context manager is less 
flexible?  (I'm +0 on this thing myself, by the way.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10074] dictobject.c: crash in Py_XDECREF

2010-10-12 Thread Sridhar Ratnakumar

New submission from Sridhar Ratnakumar :

I noticed that Python 2.6.6 crashes on OSX 10.6 when using Komodo. The below 
traceback indicates a crash in line 911 - "Py_XDECREF(ep->me_value);" in 
tags/r266/Objects/dictobject.c

Thread 0:  Dispatch queue: com.apple.main-thread
0   org.activestate.ActivePython26  0x129a3716 dict_dealloc + 82 
(dictobject.c:911)
1   org.activestate.ActivePython26  0x12976ed1 instance_dealloc + 437 
(classobject.c:669)
2   org.activestate.ActivePython26  0x129a3752 dict_dealloc + 142 
(dictobject.c:907)
3   org.activestate.ActivePython26  0x129bfcdd subtype_dealloc + 884 
(typeobject.c:1004)
4   org.activestate.ActivePython26  0x12994f96 list_dealloc + 212 
(listobject.c:306)
5   org.activestate.ActivePython26  0x129a2f81 insertdict + 122 
(dictobject.c:459)
6   org.activestate.ActivePython26  0x129a33d9 PyDict_SetItem + 92 
(dictobject.c:701)
7   org.activestate.ActivePython26  0x129a8f2e PyObject_GenericSetAttr + 
262 (object.c:1504)
8   org.activestate.ActivePython26  0x129a7c2b PyObject_SetAttr + 135 
(object.c:1252)
9   org.activestate.ActivePython26  0x12a08132 PyEval_EvalFrameEx + 8529 
(ceval.c:1864)
10  org.activestate.ActivePython26  0x12a0bcaa PyEval_EvalFrameEx + 23753 
(ceval.c:3836)
11  org.activestate.ActivePython26  0x12a0bcaa PyEval_EvalFrameEx + 23753 
(ceval.c:3836)
12  org.activestate.ActivePython26  0x12a0cbca PyEval_EvalCodeEx + 1973 
(ceval.c:3000)
13  org.activestate.ActivePython26  0x12990d81 function_call + 162 
(funcobject.c:524)
14  org.activestate.ActivePython26  0x12963b46 PyObject_Call + 77 
(abstract.c:2492)
15  org.activestate.ActivePython26  0x12a08f3b PyEval_EvalFrameEx + 12122 
(ceval.c:4063)
16  org.activestate.ActivePython26  0x12a0cbca PyEval_EvalCodeEx + 1973 
(ceval.c:3000)
17  org.activestate.ActivePython26  0x12990d81 function_call + 162 
(funcobject.c:524)
18  org.activestate.ActivePython26  0x12963b46 PyObject_Call + 77 
(abstract.c:2492)
19  org.activestate.ActivePython26  0x12974615 instancemethod_call + 401 
(classobject.c:2579)
20  org.activestate.ActivePython26  0x12963b46 PyObject_Call + 77 
(abstract.c:2492)
21  org.activestate.ActivePython26  0x12968e47 PyObject_CallMethod + 154 
(abstract.c:2524)
22  libpyxpcom.dylib0x0078cdde 
PyXPCOM_XPTStub::CallMethod(unsigned short, XPTMethodDescriptor const*, 
nsXPTCMiniVariant*) + 242

Even though the traceback is for ActivePython (that Komodo includes), this 
seems to happen with the official Python binaries as well: 
http://www.gossamer-threads.com/lists/python/python/844086

--
assignee: ronaldoussoren
components: Interpreter Core, Macintosh
messages: 118449
nosy: ronaldoussoren, srid
priority: normal
severity: normal
status: open
title: dictobject.c: crash in Py_XDECREF
type: crash
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10049] Add a "no-op" (null) context manager to contextlib

2010-10-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

I'm with Antoine. Why not just do this in the context function itself?
I think it's more explicit and easier than reading the doc to figure out what 
nullcontext is supposed to do:


from contextlib import contextmanager

CONDITION = False

@contextmanager
def transaction():
if not CONDITION:
yield None
else:
yield ...

with transaction() as x:
...

--
nosy: +giampaolo.rodola

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

I think the error message should be changed from 'allowed' to 'supported', 
though.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

With this explanation, I agree with Senthil’s plan too.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

> if you are saying, "the user asked for it, it *should* fail", then
> that is indeed one of the arguments put forward in issue 9992 where
> this was discussed.
You could put it that way, thanks for phrasing my thoughts :)

> But I think the emerging consensus is that it is better to just avoid
> the problem by always using the locale on Unix,
*displays his lack of knowledge* Is it always correct to decode a filename with 
the locale encoding on Unix?  Can’t each filesystem have its own encoding?

> and solve the problem that PYTHONFSENCODING was supposed to solve in a
> different way (by always using utf-8 on OSX and unicode on Windows).
If there is a better alternate way, let’s go for it, and maybe remove 
PYTHONFSENCODING altogether, since it’s new in 3.2.

Thanks for explaining!  I’ll repay your time by reviewing the doc patches.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

Éric, if you are saying, "the user asked for it, it *should* fail", then that 
is indeed one of the arguments put forward in issue 9992 where this was 
discussed.  But I think the emerging consensus is that it is better to just 
avoid the problem by always using the locale on Unix, and solve the problem 
that PYTHONFSENCODING was supposed to solve in a different way (by always using 
utf-8 on OSX and unicode on Windows).

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> How about this phrasing: “Make 2to3 fixers not touch code in a block
> starting with ’if sys.version >= '3'’“ (and hexversion, version_info,
> you get the idea)?

I don't think this can work. You may have to write code like

if sys.version_info >= (3,):
  try:
some_code()
  except Exception, e:
pass

(i.e. not use the "as" syntax), because it otherwise won't parse on
Python 2. Hence, one has to rely on 2to3 fixing it, even though
it will never be run on Python 2.

So any scheme of skipping code must be opt-in.

While I now understand what is being requested, I still fail to see
the rationale. In my applications of 2to3, I never look at the generated
code, so it doesn't bother me at all if print gets another pairs of
brackets, or if redundant (but dead) import statements are inserted.

In fact, I also avoid writing code explicitly so that it works
unmodified on Python 3 if I know that 2to3 will fix it.

There has been a long-standing request to suppress 2to3 in certain
expressions in cases where the 2to3 conversion would actually be
incorrect. However, this does not seem to be the motivation here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

Éric: WellI suppose that depends on how you look at it.

The RFC says that 'file:' does not specify a network protocol, and so "it's 
utility in network protocols between hosts is limited".  So, technically an 
implementation that decides to handle 'file://' by using ftp isn't 
*wrong*, but it certainly isn't something that someone writing a 'file:' uri 
should expect to work.

I agree with Senthil, I am -1 on backporting this to earlier versions because 
of the potential for breaking "working" applications (even though those 
applications shouldn't really be working :)

Antoine: except that the RFC allows FQDNs in 'file:' URIs.  So I don't think we 
can just reject them.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

(by disable I meant disallow, sorry)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I'd say disable hostnames in file:// URIs altogether. There's no practical 
reason for forcing a hostname in there, and trying to check that it matches the 
local host's FQDN sounds like a distraction.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10067] itertools' docs put izip_longest in the "terminating on the shortest input sequence" section

2010-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +rhettinger
versions:  -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10066] xmlrpclib does not handle some non-printable characters properly

2010-10-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

The patch is incorrect. Even though this may let get these characters 
"through", the other end will have no clue that \x is meant as an escape.

Please face the ugly truth: XML (and hence XML-RPC) just does not support these 
characters, see http://www.w3.org/TR/REC-xml/#NT-Char

This is fixed slightly in XML 1.1 (which allows to refer to these characters by 
character reference), however, XML 1.1 is not used for XML-RPC, so this is not 
an option.

I'm closing this as "won't fix". If there is interest in doing something about 
it, I could accept a patch that rejects non-Char characters with an exception, 
instead of sending ill-formed XML. I'd recommend to use a regular expression 
for that.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8106] SSL session management

2010-10-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

http://www.openssl.org/docs/ssl/SSL_CTX_set_session_cache_mode.html suggests 
that SSL session caching already occurs by default in server mode:

“SSL_SESS_CACHE_SERVER

Server sessions are added to the session cache. When a client proposes a 
session to be reused, the server looks for the corresponding session in (first) 
the internal session cache (unless SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), 
then (second) in the external cache if available. If the session is found, the 
server will try to reuse the session. This is the default.”


A nice and easy thing to do would be to export the statistics given by 
http://www.openssl.org/docs/ssl/SSL_CTX_sess_number.html# .

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10072] ftplib documentation is unclear

2010-10-12 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

A patch would be great.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10042] total_ordering stack overflow

2010-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10039] python é.py fails with UnicodeEncodeErr or if PYTHONFSENCODING is used

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t understand why reading a filename would not respect the envvar stating 
the filesystem encoding.

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

How about this phrasing: “Make 2to3 fixers not touch code in a block starting 
with ’if sys.version >= '3'’“ (and hexversion, version_info, you get the idea)?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +benjamin.peterson, eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10069] 2to3 crash in fix_urllib.py

2010-10-12 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10066] xmlrpclib does not handle some non-printable characters properly

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the report.  Unfortunately, 2.6 only gets security fixes, not 
general bug fixes; can you tell if this applies to 2.7, 3.1 and 3.2?  If you 
have a small script that displays the problem, please attach it.

--
nosy: +eric.araujo, loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

Ah, I thought this was not a bug, because of “RFC 1738, says that host, if 
present should be the FQDN of the machine”.  If it’s a bug I’m all for fixing 
it in all three versions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

I doubt it.  As Senthil says, file invoking ftp it is a bug.  I'm just betting 
that *someone* is going to complain when it stops working in their particular 
situation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10063] file:// scheme will stop accessing via ftp protocol

2010-10-12 Thread Éric Araujo

Éric Araujo  added the comment:

file: URIs provoking FTP access seem wrong to me.  Are there widely-used tools 
displaying this behavior?

--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6322] Pdb breakpoints don't work on lines without bytecode

2010-10-12 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +georg.brandl -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I agree with David on this one.  In addition to the arguments already stated, 
the string value of an exception is not part of specification.  The exception 
is still TypeError even if the message may be confusing.  I also find that once 
read in the context of the backtrace, the error is clear enough.

I am changing this to an RFE for now, but I think this should be closed as 
"won't fix".

--
assignee:  -> belopolsky
type: behavior -> feature request
versions:  -Python 2.7, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

Another syntax could be attached to if-else and try-except.  Given:

if ...:

else:


or
try:

except ...:


if 2to3 would translate  to  or vise versa, sans
whitespace/comment differences, then it does not do so.  Instead it
assumes the blocks are for running under Python 2 and 3 respectively.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1708] improvements for linecache

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

I am indeed going to close this.  The patch isn't complete, since there's the 
line ending issue Antoine pointed out, which implies that there are also some 
missing tests.  

I doubt that linecache performance is something that affects very many people, 
but if someday someone wants to pick this up and finish it, it sounds like 
there's no objection in principle to the change.

--
nosy: +r.david.murray -BreamoreBoy
resolution:  -> later
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10070] 2to3 wishes for already-2to3'ed files

2010-10-12 Thread Hallvard B Furuseth

Hallvard B Furuseth  added the comment:

> Maybe we need to tackle this from a different angle: can you please
> specify the feature you are asking for exactly, with any syntax, API, or
> command line changes that you consider necessary?

First, nothing here is necessary, since it's just a request for a
convenience.  The syntax could be a generalization of the example I
gave:

  :   # Python 
  

and

   :
  # Python 
  

tell 2to3 "The code in  it is expected to only run (or succeed)
in Python .  Do not modify it, except it is an error if it
is a syntax error under Python 3 so the script won't even run".

':' can be some if,else,try,except, I don't know what else,
and is responsible for making different Python versions do the right
thing.

> Omitting redundant parentheses for print is a separate issue (feel
> free to open an issue); we should not mix it with this issue (which
> I still don't understand).

OK.  But I don't understand what you don't understand...

I have some Python 2 files in various stages of transition to be
runnable and correct in Python 3, while still working in Python 2.
It'd be convenient if the parts that do work under both Python 2 and 3
could be written so that 2to3 would be silent about them, without need
for different 2to3 command line options for different .py files.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10073] calendar.isleap() not checking parameter type

2010-10-12 Thread R. David Murray

R. David Murray  added the comment:

In Python we often don't type check, we just let errors happen.  It is true 
that it would make the problem clearer to do a type check and issue a specific 
error message, but I don't know if it is worth it.  (The error would already 
have been clear if it weren't for the fact that % is the string formatting 
operator...)

--
nosy: +r.david.murray
versions: +Python 3.1, Python 3.2 -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >