[issue17833] test_gdb broken PPC64 Linux

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 63f2941477d3 by Ezio Melotti in branch '2.7':
#17833: add debug output to investigate buildbot failure.
http://hg.python.org/cpython/rev/63f2941477d3

--

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



[issue17833] test_gdb broken PPC64 Linux

2013-05-07 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
Removed message: http://bugs.python.org/msg188621

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



[issue17871] Wrong signature of TextTestRunner's init function

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5dd076d441ec by Ezio Melotti in branch '3.3':
#17871: fix unittest.TextTestRunner signature in the docs.  Patch by Yogesh 
Chaudhari.
http://hg.python.org/cpython/rev/5dd076d441ec

New changeset 15ed67602ddf by Ezio Melotti in branch 'default':
#17871: merge with 3.3.
http://hg.python.org/cpython/rev/15ed67602ddf

--
nosy: +python-dev

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



[issue17871] Wrong signature of TextTestRunner's init function

2013-05-07 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee: docs@python - ezio.melotti
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
versions: +Python 3.3

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



[issue17914] add os.cpu_count()

2013-05-07 Thread Charles-François Natali

Charles-François Natali added the comment:

 I also vote +1 for returning None when the information is unknown.

I still don't like it.
If a function returns a number of CPU, it should either return an
integer = 1, or raise an exception.
None is *not* an integer.

And returning an exception is IMO useles, since the user can't do
anything with anyway, other than fallback to 1.

 Just write os.cpu_count() or 1 if you need 1 when the count is unknown ;-)

os.cpu_count() or 1 is an ugly idiom.

 See also #17444, Trent Nelson wrote an implementation of os.cpu_count().

I don't see exactly what this C implementation brings over the one in
multiprocessing (which is written in Python)?

--

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



[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable

2013-05-07 Thread Charles-François Natali

Charles-François Natali added the comment:

 PC/_msi.c: Oh, here you should remove cast to int. Example:

 PyModule_AddIntMacro(m, (int)MSIDBOPEN_CREATEDIRECT);

 I'm surprised that the does compile. You may have a 
 (int)MSIDBOPEN_CREATEDIRECT variable :-)

Probably, good catch ;-)
I'll fix that.

 Modules/fcntlmodule.c and Modules/posixmodule.c are using explicit cast to 
 long. I don't know if there is a good reason for such cast.

There's a prototype, so arguments are implicitly converted to long:

PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long);
#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)

--

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



[issue17914] add os.cpu_count()

2013-05-07 Thread STINNER Victor

STINNER Victor added the comment:

 I don't see exactly what this C implementation brings over the one
 in multiprocessing (which is written in Python)?

multiprocessing.cpu_count() creates a subprocess on BSD and Darwin to get the 
number of CPU. Calling sysctl() or sysctlnametomib() should be faster and use 
less memory.

On Windows, GetSystemInfo() is called instead of reading an environment 
variable. I suppose that this function is more reliable.

Trent's os.cpu_count() returns -1 if the count cannot be read, 
multiprocessing.cpu_count() raises NotImplementedError.

--

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



[issue17914] add os.cpu_count()

2013-05-07 Thread Charles-François Natali

Charles-François Natali added the comment:

Fair enough, I guess we should use it then.

We just have to agree on the value to return when the number of CPUs
can't be determined ;-)

--

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



[issue17914] add os.cpu_count()

2013-05-07 Thread Ezio Melotti

Ezio Melotti added the comment:

Returning None sounds reasonable to me.
Raising an exception pretty much means that the function should always be 
called in a try/except (unless you are sure that the code is running on an OS 
that knows the number of CPUs).  Returning -1 is not very Pythonic, and between 
0 and None I prefer the latter, since it's IMHO a clearer indication that the 
value couldn't be determined.

--
nosy: +ezio.melotti

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

New submission from Jan Safranek:

I have Python 2.7.4 running on Fedora Rawhide and I get segmentation fault with 
following backtrace:

#0  0x7f73f69ca5f1 in clear_weakref (self=0x7f73ff515c00) at 
Objects/weakrefobject.c:56
#1  weakref_dealloc (self=0x7f73ff515c00) at Objects/weakrefobject.c:106
#2  0x7f73f698ea27 in PyList_SetItem (op=optimized out, i=optimized 
out, newitem=optimized out) at Objects/listobject.c:218
#3  0x7f73f69ba9db in add_subclass (type=type@entry=0x7f73e00456b0, 
base=optimized out) at Objects/typeobject.c:4155
#4  0x7f73f69c440e in PyType_Ready (type=type@entry=0x7f73e00456b0) at 
Objects/typeobject.c:4120
#5  0x7f73f69c6d4b in type_new (metatype=optimized out, args=optimized 
out, kwds=optimized out) at Objects/typeobject.c:2467
#6  0x7f73f69be7d3 in type_call (type=0x7f73f6cdad00 PyType_Type, 
args=0x7f73f61e1550, kwds=0x0) at Objects/typeobject.c:725
#7  0x7f73f6954833 in PyObject_Call (func=func@entry=0x7f73f6cdad00 
PyType_Type, arg=arg@entry=0x7f73f61e1550, kw=kw@entry=0x0) at 
Objects/abstract.c:2529
#8  0x7f73f69553c9 in PyObject_CallFunctionObjArgs 
(callable=callable@entry=0x7f73f6cdad00 PyType_Type) at 
Objects/abstract.c:2760
#9  0x7f73f6a06bf3 in build_class (name=optimized out, 
bases=0x7f73f61e3910, methods=0x7f73e0045590) at Python/ceval.c:4632
#10 PyEval_EvalFrameEx (f=f@entry=0x7f73e0043a40, throwflag=throwflag@entry=0) 
at Python/ceval.c:1928
#11 0x7f73f6a0b46d in PyEval_EvalCodeEx (co=co@entry=0x7f73f61f50b0, 
globals=globals@entry=0x7f73e003bf00, locals=locals@entry=0x7f73e003bf00, 
args=args@entry=0x0, argcount=argcount@entry=0, 
kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
defcount=defcount@entry=0, closure=closure@entry=0x0) at Python/ceval.c:3253
#12 0x7f73f6a0b5a2 in PyEval_EvalCode (co=co@entry=0x7f73f61f50b0, 
globals=globals@entry=0x7f73e003bf00, locals=locals@entry=0x7f73e003bf00) at 
Python/ceval.c:667
#13 0x7f73f6a22cfc in PyImport_ExecCodeModuleEx 
(name=name@entry=0x7f73e003d760 warnings, co=co@entry=0x7f73f61f50b0, 
pathname=pathname@entry=0x7f73e003ac90 
/usr/local/lib/python2.7/warnings.pyc) at Python/import.c:709
#14 0x7f73f6a2305e in load_source_module (name=0x7f73e003d760 warnings, 
pathname=0x7f73e003ac90 /usr/local/lib/python2.7/warnings.pyc, fp=optimized 
out) at Python/import.c:1099
#15 0x7f73f6a23f59 in import_submodule (mod=mod@entry=0x7f73f6cd2ec0 
_Py_NoneStruct, subname=subname@entry=0x7f73e003d760 warnings, 
fullname=fullname@entry=0x7f73e003d760 warnings)
at Python/import.c:2700
#16 0x7f73f6a24b93 in load_next (p_buflen=synthetic pointer, 
buf=0x7f73e003d760 warnings, p_name=synthetic pointer, 
altmod=0x7f73f6cd2ec0 _Py_NoneStruct, 
mod=0x7f73f6cd2ec0 _Py_NoneStruct) at Python/import.c:2515
#17 import_module_level (locals=optimized out, level=optimized out, 
fromlist=0x7f73f6cd2ec0 _Py_NoneStruct, globals=optimized out, name=0x0) at 
Python/import.c:2224
#18 PyImport_ImportModuleLevel (name=0x7f73ff54fbf4 warnings, 
globals=optimized out, locals=optimized out, fromlist=0x7f73f6cd2ec0 
_Py_NoneStruct, level=optimized out)
at Python/import.c:2288
#19 0x7f73f6a033af in builtin___import__ (self=optimized out, 
args=optimized out, kwds=optimized out) at Python/bltinmodule.c:49
...
#61 0x7f73f6a37dbc in initsite () at Python/pythonrun.c:721
#62 Py_InitializeEx (install_sigs=1) at Python/pythonrun.c:265

(full back trace is attached, it's quite long).

(gdb) py-bt
#10 Frame 0x7f4bf8043df0, for file /usr/lib64/python2.7/warnings.py, line 281, 
in module ()
class WarningMessage(object):
#23 Frame 0x7f4bf803d300, for file /usr/lib64/python2.7/posixpath.py, line 17, 
in module ()
import warnings
#36 Frame 0x7f4bf8024fc0, for file /usr/lib64/python2.7/os.py, line 49, in 
module ()
import posixpath as path
#49 Frame 0x7f4bf801c520, for file /usr/lib64/python2.7/site.py, line 62, in 
module ()
import os

I get the same crash with vanilla Python 2.7.4 without Fedora patches. Python 
2.7.3 works well and doesn't crash.

--
components: Interpreter Core
files: full-bt.txt
messages: 188629
nosy: jsafrane
priority: normal
severity: normal
status: open
title: Crash in clear_weakref
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file30161/full-bt.txt

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

Jan Safranek added the comment:

I can reproduce the crash in very unusual setup:
1. OpenPegasus (http://www.openpegasus.org/), for this bug we may consider it 
just a network daemon, listening on TCP port. When a request comes, it is 
eventually processed by a provider (= something like plugin).
2. cmpi-bindings ([1], [2]), which allows to write these plugins in Python
+ some other python modules, but IMHO not relevant (e.g. pywbem [3])

1: https://github.com/kkaempf/cmpi-bindings
2: http://sourceforge.net/apps/mediawiki/pywbem/index.php?title=Provider_Home
3: http://sourceforge.net/apps/mediawiki/pywbem/index.php?title=Main_Page

Now, if the Pegasus daemon gets a request, it calls cmpi-bindings, which 
creates embedded Python [4], loads the python plugin, and processes the 
request. If the plugin is idle for 15 minutes, it is unloaded by Pegasus (= 
the embedded Python is destroyed). So far everything works like charm. But, 
when new request arrives *after* the unload, Pegaasus calls cmpi-bindings 
again, which tries to create the embedded Python for second time and here I get 
the crash.

[4]: python initialization/shutdown: 
https://github.com/kkaempf/cmpi-bindings/blob/master/src/target_python.c, 
TargetInitialize() and TargetCleanup(), some marcos are generated by swig from 
https://github.com/kkaempf/cmpi-bindings/blob/master/swig/cmpi.i

I haven't been able to reproduce the crash with simpler setup (and I have 
tried, believe me). It is also possible that the Python initialization/shutdown 
in cmpi-bindings is wrong, but I am not able to find any bug here.

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

Jan Safranek added the comment:

Bisecting Python mercurial repository, I found the patch which causes the crash:

changeset:   80762:7e771f0363e2
branch:  2.7
parent:  80758:29627bd5b333
user:Antoine Pitrou solip...@pitrou.net
date:Sat Dec 08 21:15:26 2012 +0100
summary: Issue #16602: When a weakref's target was part of a long 
deallocation chain, the object could remain reachable through its weakref even 
though its refcount had dropped to zero.

If I revert the patch in Python 2.7.4, my setup works fine, without any crash.

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +benjamin.peterson, pitrou

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



[issue17714] str.encode('base64') add trailing new line character. It is not documented.

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8b764c3521fa by Ezio Melotti in branch '2.7':
#17714: document that the base64 codec adds a trailing newline.
http://hg.python.org/cpython/rev/8b764c3521fa

--
nosy: +python-dev

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



[issue17714] str.encode('base64') add trailing new line character. It is not documented.

2013-05-07 Thread Ezio Melotti

Ezio Melotti added the comment:

The str.encode() doc is the wrong place where to document this, since the '\n' 
is added only for the base64 codec.  I added a note about this in the codecs 
docs[0].

[0]: http://docs.python.org/2/library/codecs.html#standard-encodings

--
assignee: docs@python - ezio.melotti
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue17714] str.encode('base64') add trailing new line character. It is not documented.

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cbb23e40e0d7 by Ezio Melotti in branch '3.3':
#17714: document that the base64 codec adds a trailing newline.
http://hg.python.org/cpython/rev/cbb23e40e0d7

New changeset b3e1be1493a5 by Ezio Melotti in branch 'default':
#17714: merge with 3.3.
http://hg.python.org/cpython/rev/b3e1be1493a5

--

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



[issue13515] Consistent documentation practices for security concerns and considerations

2013-05-07 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage: patch review - commit review

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



[issue17923] test glob with trailing slash fail

2013-05-07 Thread Delhallt

New submission from Delhallt:

test_glob's trailing_slash tests fails on AIX 6.1/Python 2.7.4:

The code section for no_magic/slash case seems to be the issue.

Attached patch resolves issue.

FAIL: test_glob_directory_with_trailing_slash (test.test_glob.GlobTests)
--
Traceback (most recent call last):
  File /opt/freeware/lib/python2.7/test/test_glob.py, line 120, in 
test_glob_directory_with_trailing_slash
self.assertEqual(res, [])
AssertionError: Lists differ: ['@test_7602318_tmp_dir/ZZZ/'] != []

First list contains 1 additional elements.
First extra element 0:
@test_7602318_tmp_dir/ZZZ/

- ['@test_7602318_tmp_dir/ZZZ/']
+ []

==
FAIL: test_glob_unicode_directory_with_trailing_slash (test.test_glob.GlobTests)
--
Traceback (most recent call last):
  File /opt/freeware/lib/python2.7/test/test_glob.py, line 137, in 
test_glob_unicode_directory_with_trailing_slash
self.assertEqual(res, [])
AssertionError: Lists differ: [u'@test_7602318_tmp_dir/ZZZ/'... != []

First list contains 1 additional elements.
First extra element 0:
@test_7602318_tmp_dir/ZZZ/

- [u'@test_7602318_tmp_dir/ZZZ/']
+ []

--
components: Tests
files: Python-2.7.4-glob.patch
keywords: patch
messages: 188635
nosy: delhallt
priority: normal
severity: normal
status: open
title: test glob with trailing slash fail
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file30162/Python-2.7.4-glob.patch

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hi Jan,

First, have you seen the following message on that bug report:
http://bugs.python.org/issue16602#msg177180

Second, I would suggest you build a debug build of Python (./configure 
--with-pydebug), it should give you more information in the stack trace, and 
allow you to debug using gdb.

--

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



[issue11816] Refactor the dis module to provide better building blocks for bytecode analysis

2013-05-07 Thread Nick Coghlan

Nick Coghlan added the comment:

I checked in the missing file after I woke up this morning. Maybe I'll learn to 
use hg import instead of patch some day...

Sorry for the noise.

--
status: open - closed

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



[issue17912] thread states should use a doubly-linked list

2013-05-07 Thread Charles-François Natali

Charles-François Natali added the comment:

 There are a couple other places, IIRC. That said, I'm not sure what the
 point is, since a linked list is quite a simple structure anyway?

Well, it was just to avoid code duplication, and gain a nice iteration macro ;-)

Anyway, I'll submit a patch later today.

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

Jan Safranek added the comment:

 First, have you seen the following message on that bug report:
 http://bugs.python.org/issue16602#msg177180

I'm reading it now... I searched for PyWeakref_GET_OBJECT in cmpi-bindings and 
both occurrences generated by SWIG and both look safe.
Is it hidden/wrapped by any other macro?

Sorry, I don't know much about python internals and extension development, I'm 
not author of cmpi-bindings.

And I'm attaching stack trace with --with-pydebug. Debugging with gdb is quite 
a problem, I have gdb linked with distribution Python 2.7.4 and it doesn't 
cooperate with my custom built python, which I have in LD_LIBRARY_PATH (so 
Pegasus gets the right one when loading providers).

--
Added file: http://bugs.python.org/file30163/full-bt.txt

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



[issue17915] Encoding error with sax and codecs

2013-05-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is not working fine on Python 3.3.0.

 with codecs.open('/tmp/test.txt', 'w', encoding='iso-8859-1') as f:
... xml = XMLGenerator(f, encoding='iso-8859-1')
... xml.startDocument()
... xml.startElement('root', {'attr': u'\u20ac'})
... xml.endElement('root')
... xml.endDocument()
... 
Traceback (most recent call last):
  File stdin, line 4, in module
  File /home/serhiy/py/cpython-3.3.0/Lib/xml/sax/saxutils.py, line 141, in 
startElement
self._write(' %s=%s' % (name, quoteattr(value)))
  File /home/serhiy/py/cpython-3.3.0/Lib/xml/sax/saxutils.py, line 96, in 
_write
self._out.write(text)
  File /home/serhiy/py/cpython-3.3.0/Lib/codecs.py, line 699, in write
return self.writer.write(data)
  File /home/serhiy/py/cpython-3.3.0/Lib/codecs.py, line 355, in write
data, consumed = self.encode(object, self.errors)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 
7: ordinal not in range(256)

And shouldn't. On Python 2 XMLGenerator works only with binary files and 
works with text files only due implicit str-unicode converting. On Python 3 
working with binary files was broken. Issue1470548 restores working with binary 
file (for which only XMLGenerator can work correctly), but for backward 
compatibility accepting of text files was left. The problem is that there no 
trustworthy method to determine whenever a file-like object is binary or text.

Accepting of text streams in XMLGenerator should be deprecated in future 
versions.

--

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



[issue17924] Deprecate stat.S_IF* integer constants

2013-05-07 Thread Christian Heimes

New submission from Christian Heimes:

Related to #11016
I like to deprecate the S_IF* constants in favor of the S_IS*() functions.

rationals:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

No new S_IFMT symbolic names for the file type values of mode_t will be defined 
by POSIX.1-2008; if new file types are required, they will only be testable 
through S_ISxx() or S_TYPEISxxx() macros instead.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 188641
nosy: christian.heimes, docs@python
priority: normal
severity: normal
status: open
title: Deprecate stat.S_IF* integer constants
type: behavior
versions: Python 3.4

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



[issue17915] Encoding error with sax and codecs

2013-05-07 Thread STINNER Victor

STINNER Victor added the comment:

 Accepting of text streams in XMLGenerator should be deprecated in future 
 versions.

I agree that the following pattern is strange:

with codecs.open('/tmp/test.txt', 'w', encoding='iso-8859-1') as f:
   xml = XMLGenerator(f, encoding='iso-8859-1')

Why would I specify a codec twice? What happens if I specify two
different codecs?

with codecs.open('/tmp/test.txt', 'w', encoding='utf-8') as f:
   xml = XMLGenerator(f, encoding='iso-8859-1')

It may be simpler (and safer?) to reject text files. If you cannot
detect that f is a text file, just make it explicit in the
documentation that f must be a binary file.

2013/5/7 Serhiy Storchaka rep...@bugs.python.org:

 Serhiy Storchaka added the comment:

 It is not working fine on Python 3.3.0.

 with codecs.open('/tmp/test.txt', 'w', encoding='iso-8859-1') as f:
 ... xml = XMLGenerator(f, encoding='iso-8859-1')
 ... xml.startDocument()
 ... xml.startElement('root', {'attr': u'\u20ac'})
 ... xml.endElement('root')
 ... xml.endDocument()
 ...
 Traceback (most recent call last):
   File stdin, line 4, in module
   File /home/serhiy/py/cpython-3.3.0/Lib/xml/sax/saxutils.py, line 141, in 
 startElement
 self._write(' %s=%s' % (name, quoteattr(value)))
   File /home/serhiy/py/cpython-3.3.0/Lib/xml/sax/saxutils.py, line 96, in 
 _write
 self._out.write(text)
   File /home/serhiy/py/cpython-3.3.0/Lib/codecs.py, line 699, in write
 return self.writer.write(data)
   File /home/serhiy/py/cpython-3.3.0/Lib/codecs.py, line 355, in write
 data, consumed = self.encode(object, self.errors)
 UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in 
 position 7: ordinal not in range(256)

 And shouldn't. On Python 2 XMLGenerator works only with binary files and 
 works with text files only due implicit str-unicode converting. On Python 
 3 working with binary files was broken. Issue1470548 restores working with 
 binary file (for which only XMLGenerator can work correctly), but for 
 backward compatibility accepting of text files was left. The problem is that 
 there no trustworthy method to determine whenever a file-like object is 
 binary or text.

 Accepting of text streams in XMLGenerator should be deprecated in future 
 versions.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17915
 ___

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Debugging with gdb is quite a problem, I have gdb linked with distribution 
 Python
 2.7.4 and it doesn't cooperate with my custom built python, which I have in
 LD_LIBRARY_PATH

Ok. Still, you should be able to inspect the variables at the crash point. 
Could you try to inspect the `self` variable inside weakref_dealloc, especially 
`self-wr_object` and its Py_TYPE() value? Also, what is the value of 
Py_REFCNT(self-wr_object)?

AFAICT, the only reason GET_WEAKREFS_LISTPTR() may crash is because of an 
invalid Py_TYPE(). Which should never happen.

--

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



[issue17914] add os.cpu_count()

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

As for why to not return 1, I can imagine code that checks cpu_count, and only 
if it returns the don't know result would it invoke some more expensive 
method of determining the CPU count on platforms that cpu_count doesn't 
support.  Since the os module is the home for close to the metal (well, OS) 
functions, I agree that it does not make sense to throw away the information 
that cpu_count can't actually determine the CPU count.  Contrawise, I could see 
the multiprocessing version returning 1, since it is a higher level API and 
os.cpu_count would be available for those wanting the don't know info.

--
nosy: +r.david.murray

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



[issue13515] Consistent documentation practices for security concerns and considerations

2013-05-07 Thread Nick Coghlan

Nick Coghlan added the comment:

The new section looks good to me.

Would it be appropriate to explicitly note that this is a relatively recent 
change of policy, so most of the stdlib docs don't actually follow it? (and 
patches to bring them into line would be reasonable)

--

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



[issue13515] Consistent documentation practices for security concerns and considerations

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

Probably.  Otherwise people are going to go look at the subprocess docs as an 
example...and they don't follow it.

--
nosy: +r.david.murray

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



[issue13515] Consistent documentation practices for security concerns and considerations

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Patch looks fine to me.

--

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



[issue17911] Extracting tracebacks does too much work

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

You may want two pieces of stack: the piece of stack that is above and 
including the catch point, and the piece of stack that is below it. The former 
is what gets traditionally printed in tracebacks, but the latter can be useful 
as well (see issue1553375 for a related feature request).

--

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



[issue15392] Create a unittest framework for IDLE

2013-05-07 Thread Nick Coghlan

Nick Coghlan added the comment:

I've added 2.7 to the affected versions - the core unittest framework should be 
present in all 3 versions, so the choice of if/when to backport a fix and its 
test can be made on a case-by-case basis, rather than being a foregone 
conclusion due to the lack of IDLE test infrastructure in 2.7

If/when mock is used in any tests, then a compatibility module isn't actually 
needed, 3.3 and 3.4 can just use from unittest import mock while 2.7 can use 
mock = support.import_module('mock') (so those tests will run if you arrange 
to make the mock backport from PyPI available when running the tests, but will 
be skipped otherwise).

Terry, are you happy with that plan? If so, over to you to get the ball rolling 
and commit this as a starting point :)

--
versions: +Python 2.7

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



[issue17915] Encoding error with sax and codecs

2013-05-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which adds explicit checks for codecs stream writers and adds 
tests for these cases. The tests are not entirely honest, they test only that 
XMLGenerator works with some specially prepared streams. XMLGenerator doesn't 
work with a stream with arbitrary encoding and errors handler.

--
keywords: +patch
Added file: http://bugs.python.org/file30164/XMLGenerator_codecs_stream.patch

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Richard Oudkerk

Richard Oudkerk added the comment:

The test seems to be failing on Windows.

--
nosy: +sbt
status: closed - open

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



[issue17925] asynchat.async_chat.initiate_send : del deque[0] is not safe

2013-05-07 Thread Pierrick Koch

New submission from Pierrick Koch:

Dear,

del deque[0] is not safe, see the attached patch for the 
asynchat.async_chat.initiate_send method.
fix the IndexError: deque index out of range of del self.producer_fifo[0]

Best,
Pierrick Koch

--
components: Library (Lib)
files: asynchat.async_chat.initiate_send.deldeque.patch
keywords: patch
messages: 188652
nosy: Pierrick.Koch
priority: normal
severity: normal
status: open
title: asynchat.async_chat.initiate_send : del deque[0] is not safe
type: crash
versions: Python 3.3
Added file: 
http://bugs.python.org/file30165/asynchat.async_chat.initiate_send.deldeque.patch

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



[issue12535] Chained tracebacks are confusing because the first traceback is minimal

2013-05-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Marking this as Library as well, since the traceback module should also be 
updated.

--
components: +Library (Lib)

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



[issue17915] Encoding error with sax and codecs

2013-05-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Of course, if this patch will be committed, perhaps it will be worth to apply 
it also for 3.2 which has the same regression.

--
components: +XML
stage: needs patch - patch review
versions: +Python 3.2

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



[issue14146] IDLE: source line in editor doesn't highlight when debugging

2013-05-07 Thread Roger Serwy

Roger Serwy added the comment:

I'm pinging this issue to see if anyone has had any problems with the 
Windows-specific workaround for highlighting the selection tags. Issue17511 
depends on this fix.

--
assignee:  - roger.serwy

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



[issue12458] Tracebacks should contain the first line of continuation lines

2013-05-07 Thread Kushal Das

Kushal Das added the comment:

I have been able to get the logical line details (start of it), now working on 
to print the required lines.
The current way of showing source lines removes any indentation, but to show 
all the physical lines (related to the logical line) one should show the 
indentation to match the source. Is this the correct way I should go forward?

--

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



[issue17915] Encoding error with sax and codecs

2013-05-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps we should add a deprecation warning for codecs streams right in this 
patch?

--

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



[issue13515] Consistent documentation practices for security concerns and considerations

2013-05-07 Thread Ezio Melotti

Ezio Melotti added the comment:

We could use the SSL docs[0] as example instead of subprocess.

[0]: http://docs.python.org/3/library/ssl.html#security-considerations

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

Jan Safranek added the comment:

 Could you try to inspect the `self` variable inside weakref_dealloc,
 especially `self-wr_object` and its Py_TYPE() value? Also, what is the
 value of Py_REFCNT(self-wr_object)?

in weakref_dealloc at Objects/weakrefobject.c:106:

(gdb) p *self
$1 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0, ob_type = 0x7fdb8ffc91a0 
_PyWeakref_RefType}

(gdb) p *((PyWeakReference*)self)
$7 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0, ob_type = 0x7fdb8ffc91a0 
_PyWeakref_RefType, wr_object = 0x7fdb9c30bc00 swigpyobject_type.9541, 
wr_callback = 0x0, hash = -1, 
  wr_prev = 0x0, wr_next = 0x0}

(gdb) p *((PyWeakReference*)self)-wr_object
$9 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0, ob_type = 0x0}

If I am reading Py_TYPE right, Py_TYPE(self-wr_object) must be 0 (=NULL).

swigpyobject_type.9541 seems to be PyTypeObject generated by SWIG in 
cmpi-bindings, I'll dig into it. Please let me know if there is anything 
suspicious or worth checking.

--

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



[issue4831] exec() behavior - revisited

2013-05-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 (gdb) p *((PyWeakReference*)self)-wr_object
 $9 = {_ob_next = 0x0, _ob_prev = 0x0, ob_refcnt = 0, ob_type = 0x0}
 
 If I am reading Py_TYPE right, Py_TYPE(self-wr_object) must be 0
 (=NULL).

Well, no, it should *always* be non-NULL (and it's a strong reference,
so it should be a pointer to a valid PyTypeObject).
There's nothing in the CPython source code which sets Py_TYPE(something)
(i.e. something-ob_type) to NULL.

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

swigpyobject_type is a static PyTypeObject variable (similar to all static 
PyTypeObject structures we write in extension modules, but inside a function)

It should never be deallocated... There may be a refcount issue with this 
object.

--
nosy: +amaury.forgeotdarc

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



[issue12458] Tracebacks should contain the first line of continuation lines

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

Can you preserve just the *additional* indentation?  That is, strip the excess 
leading whitespace, but preserve the logical indentation, like textwrap.dedent 
does?

--

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



[issue17925] asynchat.async_chat.initiate_send : del deque[0] is not safe

2013-05-07 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +giampaolo.rodola

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 swigpyobject_type is a static PyTypeObject variable (similar to all
 static PyTypeObject structures we write in extension modules, but
 inside a function)
 
 It should never be deallocated... There may be a refcount issue with
 this object.

Even if it's deallocated, the Py_TYPE of an instance should never
become NULL. At worse it may point to invalid memory.

--

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The test seems to be failing on Windows.

Yes. I'll try to setup a new Windows dev environment and take a look :-/

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Right. But this is an embedded interpreter, and SWIG does not call 
PyType_Ready() again; the old type is returned instead.

--

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread David Edelsohn

Changes by David Edelsohn dje@gmail.com:


--
type:  - behavior

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread David Edelsohn

New submission from David Edelsohn:

The PowerLinux buildslave fails in test_dbm:test_keys() because of a problem 
with the in operator.

 import dbm
 d = dbm.open('t','c')
 a = [('a', 'b'), ('12345678910', '019237410982340912840198242')]
 for k,v in a:
... d[k] = v
... 
 print d
dbm.dbm object at 0x3fff93073110
 print d.keys()
['a', '12345678910']
 print 'a' in d
False  --- This apparently should be True
 print 'a' in d.keys()
True

--
components: Interpreter Core
messages: 188666
nosy: David.Edelsohn
priority: normal
severity: normal
status: open
title: PowerLinux dbm failure in 2.7
versions: Python 2.7

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread David Edelsohn

Changes by David Edelsohn dje@gmail.com:


--
nosy: +pitrou

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 But this is an embedded interpreter, and SWIG does not call
 PyType_Ready() again; the old type is returned instead.

Yuk. Perhaps Dave Beazley can give us some insights here?

Jan, one possibility would be for Pegasus to stop unloading Python, it seems.

--
nosy: +dabeaz

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Jan Safranek

Jan Safranek added the comment:

 Right. But this is an embedded interpreter, and SWIG does not call
 PyType_Ready() again; the old type is returned instead.

Python crashes in Py_Initialize(). SWIG_init() is called right after it.
So even if SWIG calls PyType_Ready, it would be too late.

Why python remembers SWIG types after Py_Finalize() in the first place?
I want to destroy it and start with fresh instance.

Jan

--

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Can you try the other dbm methods? e.g. has_key(), get()...

--

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Python remembers SWIG types because SWIG generates code like this:

PyTypeObject * SwigPyObject_TypeOnce(void) {
  static PyTypeObject swigpyobject_type;
  static int type_init = 0;
  if (!type_init) {
// ... initialization code ...
swigpyobject_type = tmp;
type_init = 1;
if (PyType_Ready(swigpyobject_type)  0)
  return NULL;
  }
}

SWIG should reset type_init on a fresh interpreter.
The initXxx() function should do this.

--

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Forget it, can you just try the following patch?

diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -168,11 +168,13 @@
 dbm_contains(register dbmobject *dp, PyObject *v)
 {
 datum key, val;
+char *ptr;
+Py_ssize_t size;
 
-if (PyString_AsStringAndSize(v, (char **)key.dptr,
- (Py_ssize_t *)key.dsize)) {
+if (PyString_AsStringAndSize(v, ptr, size))
 return -1;
-}
+key.dptr = ptr;
+key.dsize = size;
 
 /* Expand check_dbmobject_open to return -1 */
 if (dp-di_dbm == NULL) {

--

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



[issue17927] Argument copied into cell still referenced by frame

2013-05-07 Thread Guido van Rossum

New submission from Guido van Rossum:

This came out of some investigations into Tulip reference cycles.  I've only 
confirmed this with 3.3 and 3.4, but I suspect it's a problem in earlier 
versions too.

The scenario is as follows.

Consider a object with a method that ends up catching an exception and storing 
the exception on the object.  We know that the __traceback__ attribute of the 
exception references the stack frame where the exception was caught, so there 
is a cycle: self - exception - traceback - frame - self.  To break this 
cycle without disturbing the __traceback__ on the exception, the method sets 
self = None before it returns.  (The point of breaking the cycle is that at 
some later point when the object is deleted the traceback can be printed by the 
__del__ method.)

This works beautifully...  Except if the function happens to contain a nested 
function or a lambda that references 'self'.  *Even if the function is never 
created* (e.g. if 0: lambda: self).  Then setting self = None does not 
break the cycle.  It's not a real leak, because gc.collect() will collect the 
cycle.  But it's still annoying that I can't break the cycle (I don't want to 
break it at any other point because it would reduce the usefulness of the 
exception stored on the object).

After two days of investigations and thinking about it I found the cause: the 
presence of the lambda cause a cell to be created into which self is copied, 
but the original self argument is still referenced by the frame.  Setting self 
= None clears the cell but doesn't affect the original self argument.  (FWIW, 
this indicates it's not specifically about self, it's about any argument that 
gets copied into a cell.)

I thought I had a one-line fix (see cellfree.diff attached) but it breaks 
argument-less super(), which looks at the original first argument.  I think I 
can fix super() (it must introspect the code object to find out into which cell 
self has been copied, if it finds it NULL), but I have to think about that 
more.  If anyone wants to jump in and suggest an approach to that I'd 
appreciate it.

--
assignee: gvanrossum
components: Interpreter Core
files: cellfree.diff
keywords: patch
messages: 188672
nosy: gvanrossum
priority: normal
severity: normal
stage: needs patch
status: open
title: Argument copied into cell still referenced by frame
type: resource usage
versions: Python 3.3
Added file: http://bugs.python.org/file30166/cellfree.diff

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



[issue17922] Crash in clear_weakref

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Why python remembers SWIG types after Py_Finalize() in the first
 place?
 I want to destroy it and start with fresh instance.

Because a significant amount of static data inside CPython actually
survives Py_Finalize :-/

--

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread David Edelsohn

David Edelsohn added the comment:

My example and test_dbm succeeds on Python2.7 with your patch applied.
Thanks!

--

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok. This is a classic example of why a big-endian buildbot is useful :)

--
stage:  - commit review

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



[issue17917] use PyModule_AddIntMacro() instead of PyModule_AddIntConstant() when applicable

2013-05-07 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


Added file: http://bugs.python.org/file30167/ins_macro-2.diff

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



[issue17912] thread states should use a doubly-linked list

2013-05-07 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


--
keywords: +needs review, patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file30168/pystate.diff

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



[issue16569] Preventing errors of simultaneous access in zipfile

2013-05-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
Removed message: http://bugs.python.org/msg176850

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



[issue16569] Preventing errors of simultaneous access in zipfile

2013-05-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
Removed message: http://bugs.python.org/msg176851

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



[issue17883] Fix buildbot testing of Tkinter

2013-05-07 Thread Ezio Melotti

Ezio Melotti added the comment:

Here's the traceback:
http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%202.7/builds/435/steps/test/logs/stdio
==
ERROR: testLoadWithUNC (test.test_tcl.TclTest)
--
Traceback (most recent call last):
  File 
E:\Data\buildslave\cpython\2.7.snakebite-win2k3r2sp2-x86\build\lib\test\test_tcl.py,
 line 152, in testLoadWithUNC
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
  File 
E:\Data\buildslave\cpython\2.7.snakebite-win2k3r2sp2-x86\build\lib\subprocess.py,
 line 711, in __init__
errread, errwrite)
  File 
E:\Data\buildslave\cpython\2.7.snakebite-win2k3r2sp2-x86\build\lib\subprocess.py,
 line 948, in _execute_child
startupinfo)
WindowsError: [Error 5] Access is denied

--
Ran 21 tests in 0.578s

The buildbot also hangs on test_ttk_guionly.

--

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



[issue17928] PowerLinux getargs.c FETCH_SIZE endianness bug

2013-05-07 Thread David Edelsohn

New submission from David Edelsohn:

Another endianness bug that causes a failure in test_structmembers.py.

_testcapi reports string too long because 
getargs.c:PyArg_ParseTupleAndKeywords() incorrectly returns a huge value for 
string_len.

The problem is FETCH_ARGS is passing the wrong type to va_arg.  It grabs an 
int for the size arg, but that is the not the argument type on 64 bit 
platforms.  This happens to work for little endian because the low part of the 
64 bit argument overlaps correctly.  Big endian is not as fortuitous.

If I change int to long, the testcase succeeds.

diff -r a285ce18bd55 Python/getargs.c
--- a/Python/getargs.c  Mon May 06 18:21:10 2013 -0700
+++ b/Python/getargs.c  Tue May 07 11:26:21 2013 -0700
@@ -582,9 +582,9 @@
   char *msgbuf, size_t bufsize, PyObject **freelist)
 {
 /* For # codes */
-#define FETCH_SIZE  int *q=NULL;Py_ssize_t *q2=NULL;\
+#define FETCH_SIZE  long *q=NULL;Py_ssize_t *q2=NULL;\
 if (flags  FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \
-else q=va_arg(*p_va, int*);
+else q=va_arg(*p_va, long*);
 #define STORE_SIZE(s)   \
 if (flags  FLAG_SIZE_T) \
 *q2=s; \

I am not certain exactly what type it should be, but it definitely needs to be 
a matching 64 bit type of 64 bit platforms.

I believe that this bug exists in all versions.

--
components: Interpreter Core
messages: 188677
nosy: David.Edelsohn, pitrou
priority: normal
severity: normal
status: open
title: PowerLinux getargs.c FETCH_SIZE endianness bug
type: behavior
versions: Python 2.7

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I think the problem is that the __del__ method fails on Windows, maybe because 
sys.stdout and sys.__stderr__ have been replaced by None.

Consider the following program:

  import os

  class C:
  def __del__(self, write=os.write):
  write(1, bBEFORE\n)
  print(__del__ called)
  write(1, bAFTER\n)

  l = [C()]
  l.append(l)

On Unix I get

  BEFORE
  __del__ called
  AFTER

but on Windows I only get

  BEFORE

I would suggest using os.write() instead of print() in the tests.

--

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I will try a fix.

--

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



[issue14191] argparse doesn't allow optionals within positionals

2013-05-07 Thread Glenn Linderman

Glenn Linderman added the comment:

Paul, thanks for your continued work.

I had reworked your prior patch into a subclass of Argument Parser, and 
tweaking the code to get parse_intermixed_args to adjust the behaviors I had 
reported.

Now substituting exactly your more flexible new code into my subclass from your 
latest test_intermixed.py (you should delete your old patches), I can quickly 
confirm that it works with my applications that used to use my wrapper class, 
and expect and use intermixed functionality.

I also read through all your code and comments and it looks good to me.

Regarding parse_fallback_args, I do not see documentation for it. If that is 
intentional, you might want to add comments in the code regarding its use for 
testing only... and might want to rename it to _parse_fallback_args. I 
personally don't see a lot of value to the function, or the new parameter; 
tests for parse_intermixed_args and parse_known_intermixed_args should be (and 
have been, thanks) added to the tests for argparse, and should suffice for 
testing. In non-test code, I see no benefit: either the user uses features that 
are incompatible with parse_intermixed_args, and thus uses the other features 
of argparse, or the user, for compatibility reasons, needs to use 
parse_intermixed_args, and thus is prevented from successfully using the 
incompatible features. If I'm missing some benefit of parse_fallback_args, it 
should be explained in either the documentation or the comments.

Regarding the terminology: both intermixed and interspersed would be correct 
English words to describe the use case. So would intermingled :)

Because Stephen blessed intermixed, and because it is used by getopt 
documentation (getopt has not been deprecated, optparse has), it seems to be 
the best term to use. Should optparse someday be removed, along with its 
documentation, the use of the term interspersed would also disappear, leaving 
more consistency in terminology.

Alternative:

Because optparse uses interspersed in an API, we cannot fix it to use 
intermixed. However, we could fix the uses of intermixed to be 
interspersed prior to or at the time of accepting your patch to argparse... 
afterwards, it would be too late.  Personally, I see no problem with the use of 
both terms in the documentation, and intermixed is the shortest, so I have a 
slight preference for that.

--

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



[issue17927] Argument copied into cell still referenced by frame

2013-05-07 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
nosy: +ubershmekel

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On Windows my encoding for stdout, stderr is cp1252 which is implemented in 
pure python.

By the time that _PyGC_DumpShutdownStats() runs the encoding.cp1252 module has 
been purged so stdout and stderr are broken.

I am afraid I will have to leave this to you Antoine...

--

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



[issue17929] TypeError using tarfile.addfile() with io.StringIO replacing StringIO.StringIO()

2013-05-07 Thread Firstname Lastname

New submission from Firstname Lastname:

Trying to work with tarfile library and python 3.3 (Ubuntu 13.04 64-bit)

While everything works quite well using StringIO.StringIO() and python 2.7.4, 
the equivalent code with io.StringIO() and python 3.3.1 doesn't. Is that a bug 
or am I doing something wrong ?

--
components: Library (Lib)
files: showbug.py
messages: 188682
nosy: Firstname.Lastname
priority: normal
severity: normal
status: open
title: TypeError using tarfile.addfile() with io.StringIO replacing 
StringIO.StringIO()
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file30169/showbug.py

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



[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable

2013-05-07 Thread Till Maas

Till Maas added the comment:

When might this be patched in Python 2.X? This Exception makes the function 
pretty useless for me, since it makes by custom compare script crash.

--

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



[issue17929] TypeError using tarfile.addfile() with io.StringIO replacing StringIO.StringIO()

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

Basic questions like this aren't really suitable for the tracker, you should 
use other forums such as the python-list mailing list or the #python irc 
channel.

In Python3, bytes and strings are different classes, but in Python2 they are 
not.  You need to be working with BytesIO.

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

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



[issue17929] TypeError using tarfile.addfile() with io.StringIO replacing StringIO.StringIO()

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

Bah, I should reread my messages *before* I hit submit.  A better phrasing 
would be questions like this aren't what the tracker is intended to answer, 
you will get more and better help from... :)

(The bytes/string split is the most important thing to understand about python3 
vs python2.)

--

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



[issue17930] Search not needed in combinations_with_replacement

2013-05-07 Thread Tim Peters

New submission from Tim Peters:

Each time thru, CWR searches for the rightmost position not containing the 
maximum index.  But this is wholly determined by what happened the last time 
thru - search isn't really needed.  Here's Python code:

def cwr2(iterable, r):
pool = tuple(iterable)
n = len(pool)
if not n and r:
return
indices = [0] * r
yield tuple(pool[i] for i in indices)
j = r-1 if n  1 else -1
while j = 0:
newval = indices[j] + 1
indices[j:] = [newval] * (r - j)
yield tuple(pool[i] for i in indices)
j = r-1 if newval  n-1 else j-1

There `j` is the rightmost position not containing the maximum index.  A little 
thought suffices to see that the next j is either r-1 (if newval is not the 
maximum index) or j-1 (if newval is the maximum index:  since the indices 
vector is non-decreasing, if indices[j] was r-2 then indices[j-1] is also at 
most r-2).

I don't much care if this goes in, but Raymond should find it amusing so 
assigning it to him ;-)

--
assignee: rhettinger
components: Extension Modules
keywords: easy
messages: 188686
nosy: rhettinger, tim_one
priority: low
severity: normal
stage: needs patch
status: open
title: Search not needed in combinations_with_replacement
type: performance
versions: Python 2.7, Python 3.5

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



[issue17930] Search not needed in combinations_with_replacement

2013-05-07 Thread Tim Peters

Tim Peters added the comment:

Oops!  Last part should read

since the indices vector is non-decreasing, if indices[j] was n-2 then 
indices[j-1] is also at most n-2

That is, the instances of r-2 in the original should have been n-2.

--

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



[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-05-07 Thread STINNER Victor

New submission from STINNER Victor:

The issue #1983 was not fixed on Windows: pid_t is HANDLE on Windows, which is 
a pointer. SIZEOF_PID_T is not defined in PC/pyconfig.h and so longobject.h 
takes the default implementation (use C long type):

/* Issue #1983: pid_t can be longer than a C long on some systems */
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
#define _Py_PARSE_PID i
#define PyLong_FromPid PyLong_FromLong
#define PyLong_AsPid PyLong_AsLong
#elif SIZEOF_PID_T == SIZEOF_LONG
...

The consequence is a compiler warning:

..\Modules\posixmodule.c(6603): warning C4244: 'function' : conversion from 
'Py_intptr_t' to 'long', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]

It would be safer to define SIZEOF_PID_T on Windows:

#define SIZEOF_PID_T SIZEOF_VOID_P

I didn't test attached patch on Windows.

Python 3.2 is affected, but I don't think that the issue is important enough to 
touch this branch (which now only accept security fixes).

See also issue #17870.

--
components: Windows
files: win_sizeof_pid_t.patch
keywords: patch
messages: 188688
nosy: haypo, serhiy.storchaka, tim.golden
priority: normal
severity: normal
status: open
title: PyLong_FromPid() is not correctly defined on Windows 64-bit
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30170/win_sizeof_pid_t.patch

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



[issue17870] Python does not provide PyLong_FromIntMax_t() or PyLong_FromUintMax_t() function

2013-05-07 Thread STINNER Victor

STINNER Victor added the comment:

@Mark: any opinion on my patch?

--

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Your diagnosis seems right about test_garbage_at_shudown
(I can reproduce under Linux using `PYTHONIOENCODING=iso8859-15 ./python -m 
test -v test_gc`).

--

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue17932] Win64: possible integer overflow in iterobject.c

2013-05-07 Thread STINNER Victor

STINNER Victor added the comment:

I don't know how to create an iterator object. How can I do that?

--

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



[issue17932] Win64: possible integer overflow in iterobject.c

2013-05-07 Thread STINNER Victor

New submission from STINNER Victor:

seqiterobject.it_index type is long, whereas iter_setstate() uses a Py_ssize_t. 
It would be safer to use Py_ssize_t type for seqiterobject.it_index.

The issue emits a compiler warning on Windows 64-bit.

iterator.__getstate__() was introduced in Python 3.3, so older versions are not 
affected.

--
files: iter_ssize_t.patch
keywords: patch
messages: 188691
nosy: haypo
priority: normal
severity: normal
status: open
title: Win64: possible integer overflow in iterobject.c
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30171/iter_ssize_t.patch

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 53da3bad8554 by Antoine Pitrou in branch '2.7':
Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.
http://hg.python.org/cpython/rev/53da3bad8554

--
nosy: +python-dev

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



[issue17926] PowerLinux dbm failure in 2.7

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Committed, thank you.

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

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



[issue17928] PowerLinux getargs.c FETCH_SIZE endianness bug

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is it 2.7-only?

--

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



[issue17928] PowerLinux getargs.c FETCH_SIZE endianness bug

2013-05-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a199ec80c679 by Antoine Pitrou in branch '2.7':
Issue #17928: Fix test_structmembers on 64-bit big-endian machines.
http://hg.python.org/cpython/rev/a199ec80c679

--
nosy: +python-dev

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



[issue1545463] New-style classes fail to cleanup attributes

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch, it seems to work on the custom buildbots. The problem was 
two-fold:
- PyErr_Warn() is too high-level, it will invoke linecache and others
- encodings and codecs shouldn't be cleared before the final shutdown

--
Added file: http://bugs.python.org/file30172/better_shutdown.patch

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



[issue17928] PowerLinux getargs.c FETCH_SIZE endianness bug

2013-05-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Fixed. _testcapi was actually the culprit.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17933] test_ftp failure / ftplib error formatting issue

2013-05-07 Thread Antoine Pitrou

New submission from Antoine Pitrou:

The following error appeared on some buildbots:
http://buildbot.python.org/all/builders/x86%20Gentoo%203.x/builds/4195/steps/test/logs/stdio

==
ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests)
--
Traceback (most recent call last):
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 2337, in retrfile
self.ftp.cwd(file)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 622, 
in cwd
return self.voidcmd(cmd)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 272, 
in voidcmd
return self.voidresp()
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 245, 
in voidresp
resp = self.getresp()
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/ftplib.py, line 240, 
in getresp
raise error_perm(resp)
ftplib.error_perm: 550 Failed to change directory.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
/var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 
112, in test_ftp
self._test_urls(urls, self._extra_handlers())
  File 
/var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 
218, in _test_urls
f = urlopen(url, req, TIMEOUT)
  File 
/var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 
33, in wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File 
/var/lib/buildslave/3.x.murray-gentoo/build/Lib/test/test_urllib2net.py, line 
23, in _retry_thrice
return func(*args, **kwargs)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 462, in open
response = self._open(req, data)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 480, in _open
'_open', req)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 440, in _call_chain
result = func(*args)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 1464, in ftp_open
fp, retrlen = fw.retrfile(file, type)
  File /var/lib/buildslave/3.x.murray-gentoo/build/Lib/urllib/request.py, 
line 2339, in retrfile
raise URLError('ftp error: %d' % reason) from reason
TypeError: %d format: a number is required, not error_perm

--
components: Library (Lib), Tests
messages: 188699
nosy: giampaolo.rodola, pitrou, r.david.murray
priority: high
severity: normal
stage: needs patch
status: open
title: test_ftp failure / ftplib error formatting issue
type: behavior
versions: Python 3.3, Python 3.4

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



[issue17931] PyLong_FromPid() is not correctly defined on Windows 64-bit

2013-05-07 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +brian.curtin

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



[issue995907] memory leak with threads and enhancement of the timer class

2013-05-07 Thread R. David Murray

R. David Murray added the comment:

Review comments added.

--
nosy: +r.david.murray

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



[issue5492] Error on leaving IDLE with quit() or exit() under Linux

2013-05-07 Thread Rajanikanth Jammalamadaka

Changes by Rajanikanth Jammalamadaka rajanika...@gmail.com:


--
nosy: +Raj

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



[issue1551113] random.choice(setinstance) fails

2013-05-07 Thread wim glenn

wim glenn added the comment:

The implementation suggested by the OP

def choice(self, seq):
Choose a random element from a non-empty 
sequence.
idx = int(self.random() * len(seq))
try:
result = seq[idx]  # raises IndexError if seq 
is empty
except TypeError:
result = list(seq)[idx]
return result

Is broken because input may be a dict with, for example, keys 0 1 and 7 - 
potentially causing the line result = seq[idx] to pass when logically it should 
raise.  Rather it would be needed to determine from the input whether it was a 
non-sequence type collection, which sounds pretty hairy...

--
nosy: +wim.glenn

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



[issue1551113] random.choice(setinstance) fails

2013-05-07 Thread wim glenn

wim glenn added the comment:

How about 

if isinstance(seq, collections.Sequence):
  # do it the usual way ..
else:
  return choice(list(seq))

--

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