[issue18813] Speed up slice object processing

2013-08-23 Thread Stefan Behnel

Stefan Behnel added the comment:

Here is another patch that remembers the Py_ssize_t slice indices if they are 
known at instantiation time. It only makes a very small difference for the 
fannkuch benchmark, so that's no reason to add both the complexity and the 
(IMHO ignorable) memory overhead.

However, it also adds a public C-API function PySlice_FromIndices() that allows 
setting the values from C code at instantiation time, thus avoiding the 
overhead of having to do the conversion back again.

It might also be worth exploring if we can't instantiate the Python object 
indices at first request using properties, iff the slice was created with 
integer indices. Meaning, we'd leave the PyObject* fields NULL in that case 
until they are being used. That would reduce the overhead of creating the slice 
object in the first place. Since we added the one-instance cache, it's now 
dominated by the creation of the index value objects when 
_PySlice_FromIndices() is being used internally (e.g. when calling 
PySequence_Get/Set/DelSlice()).

--
Added file: http://bugs.python.org/file31431/cache_slice_indices.patch

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



[issue17741] event-driven XML parser

2013-08-23 Thread Stefan Behnel

Stefan Behnel added the comment:

Ok, so what are we going to do for the next alpha?

--

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

$ PYTHONIOENCODING= ./python
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: 
Aborted (core dumped)

As a consequence we can't set only the error handler.

$ PYTHONIOENCODING=:surrogateescape ./python
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: 
Aborted (core dumped)

Here is a patch which allows accepting empty encoding as default encoding.

--
components: Interpreter Core
files: empty_pythonioencoding.patch
keywords: patch
messages: 195946
nosy: haypo, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Empty PYTHONIOENCODING is not the same as nonexistent
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31432/empty_pythonioencoding.patch

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



[issue18713] Clearly document the use of PYTHONIOENCODING to set surrogateescape

2013-08-23 Thread Serhiy Storchaka

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


--
dependencies: +Empty PYTHONIOENCODING is not the same as nonexistent

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file31432/empty_pythonioencoding.patch

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file31433/empty_pythonioencoding.patch

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



[issue18813] Speed up slice object processing

2013-08-23 Thread Serhiy Storchaka

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


--
nosy: +mark.dickinson, serhiy.storchaka
stage:  - patch review

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Nick Coghlan

Nick Coghlan added the comment:

Patch looks good to me.

--

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



[issue18816] mmap.flush() is always synchronous, hurting performance

2013-08-23 Thread Charles-François Natali

Charles-François Natali added the comment:

 I propose to add an optional keyword parameter with default value SYNC 
 (compatibility) but that can be ASYNC, INVALIDATE (can be 
 SYNC|INVALIDATE and ASYNC|INVALIDATE too).

AFAICT it's mostly useless on a modern OS.
MS_INVALIDATE is a no-op on systems with merged VM-buffer cache, i.e.
it's not needed for mmap() to reflect write() and vice-versa.

So nothing's normally needed to synchronize file and memory.

As for MS_ASYNC, it actually doesn't do anything at all on recent OS,
e.g. it's a no-op on Linux since a couple years, since modified pages
will be written back as part of the normal writeback process.

The only thing a user might actually need for an mmap object is to
make sure data is actually committed to disk, and MS_SYNC covers this.

See e.g. this post by Andrew Morton:
http://thread.gmane.org/gmane.linux.kernel/1312660

--
nosy: +neologix

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



[issue18819] tarfile fills devmajor and devminor fields even for non-devices

2013-08-23 Thread Nuutti Kotivuori

New submission from Nuutti Kotivuori:

when tarfile generates a tar, it uses TarInfo objects which are packed to the 
binary format. This packing uses itn format for filling the devmajor and 
devminor fields of the tar file entry, with a default value of zero. The 
field length is 8 characters, and the formatting will format the values as 
octal strings, followed by a NUL byte, eg. '000\x00'.

However, other common tar tools do not exhibit this behavior, instead leaving 
the field filled with NUL bytes in case the earlier type field does not 
indicate a device type. Explicitly, the value generated by other tools is then 
'\x00\x00\x00\x00\x00\x00\x00\x00'.

This causes no interoperability issues (that I am aware of), but makes it hard 
to attempt to replicate the tar files generated by other tools exactly.

I am attaching a simple diff fixing this, but there are probably better ways to 
fix this.

--
components: Library (Lib)
files: tarfile.py.diff
keywords: patch
messages: 195949
nosy: Nuutti.Kotivuori
priority: normal
severity: normal
status: open
title: tarfile fills devmajor and devminor fields even for non-devices
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5
Added file: http://bugs.python.org/file31434/tarfile.py.diff

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

Patch looks good to me, but you have to update Doc/using/cmdline.rst,
at least to add a versionchanged section.

Tests would also be nice :-)

I really like the the PYTHONIOENCODING=:surrogateescape use case!

--

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Second variant of the patch also supports empty error handler as the default 
error handler (i.e. strict).

$ PYTHONIOENCODING=ascii: ./python
Python 3.4.0a1+ (default:5b5ef012cd4e+, Aug 23 2013, 10:18:51) 
[GCC 4.6.3] on linux
Type help, copyright, credits or license for more information.
 print('\xbd')
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'ascii' codec can't encode character '\xbd' in position 0: 
ordinal not in range(128)

Without it different error is raised:

Traceback (most recent call last):
  File stdin, line 1, in module
LookupError: unknown error handler name ''

--
Added file: http://bugs.python.org/file31435/empty_pythonioencoding_2.patch

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



[issue18817] Got resource warning when running Lib/aifc.py

2013-08-23 Thread Antoine Pitrou

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


--
nosy: +serhiy.storchaka

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2013-08-23 Thread Antoine Pitrou

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


--
nosy: +vinay.sajip

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



[issue15175] pydoc -k zip throws segmentation fault

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yeah, pydoc will walk and import all installed Python modules, which may 
trigger various kinds of issues with buggy third-party stuff.

Note that in 2.x, extension modules compiled with different fundamental options 
(such as debug/non-debug) aren't differentiated, which may the be cause of the 
present issue.

--
nosy: +pitrou
resolution:  - rejected
status: pending - closed

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



[issue18623] Factor out the _SuppressCoreFiles context manager

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Will also be useful for issue #18808 :)

--

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



[issue17588] runpy cannot run Unicode path on Windows

2013-08-23 Thread Drekin

Drekin added the comment:

There is over year old closely related issue: http://bugs.python.org/issue13758 
.

--

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



[issue13758] compile() should not encode 'filename' (at least on Windows)

2013-08-23 Thread Drekin

Drekin added the comment:

Hello. Will this be fixed? It's really annoying that you cannot pass valid 
unicode filename to compile(). I'm using a workaround: I just pass 
placeholder and then “update” the resulting code object recursively to set 
the correct co_filename. Afterwards the code object can be executed and 
produces correct tracebacks. (I'm using Windows.)

Fixing this will probably fix also http://bugs.python.org/issue17588 . It 
doesn't bother just me. See e.g. 
http://stackoverflow.com/questions/8798591/unicodeencodeerror-when-using-the-compile-function
 .

Thank you. Drekin

--
nosy: +Drekin

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue16392] import crashes on circular imports in ext modules

2013-08-23 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue18811] add ssl-based generator to random module

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Seriously, why are we obsessed with performance when talking about a security 
feature? Did anyone *actually* complain about urandom() being too slow (ok, 
someone complained about it eating file descriptors... :-))?

The question is whether OpenSSL's random generator produces better randomness 
than the system one: apparently it's not the case under Linux, how about other 
systems?

--

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



[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys

2013-08-23 Thread July Tikhonov

New submission from July Tikhonov:

According to documentation of json.dump(), concerning its 'default' option:

default(obj) is a function that should return a serializable version of obj or 
raise TypeError. The default simply raises TypeError.

But this function is actually never applied to serialized dictionary keys:

 def default(obj):
...  if isinstance(obj, bytes):
...   return obj.decode('ascii')
...  raise ValueError
... 
 json.dumps(b'asdf')
Traceback (most recent call last):
...
TypeError: b'asdf' is not JSON serializable
 json.dumps(b'asdf', default=default)
'asdf'
 json.dumps({b'asdf' : 1}, default=default)
Traceback (most recent call last):
...
TypeError: keys must be a string
 json.dumps({1 : b'asdf'}, default=default)
'{1: asdf}'

(bytes are used purely for the purpose of example)
Such behavior should be either documented or corrected.
Patch correcting python implementation of json attached.

--
assignee: docs@python
components: Documentation, Library (Lib)
files: json-default-dict-keys.diff
keywords: patch
messages: 195957
nosy: docs@python, july
priority: normal
severity: normal
status: open
title: json.dump() ignores its 'default' option when serializing dictionary keys
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31436/json-default-dict-keys.diff

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



[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys

2013-08-23 Thread July Tikhonov

July Tikhonov added the comment:

Oops, my patch disables 'skipkeys' argument of dump. Another version attached.

--
Added file: http://bugs.python.org/file31437/json-default-dict-keys.diff

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



[issue18820] json.dump() ignores its 'default' option when serializing dictionary keys

2013-08-23 Thread July Tikhonov

Changes by July Tikhonov july.t...@gmail.com:


Removed file: http://bugs.python.org/file31436/json-default-dict-keys.diff

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



[issue18652] Add itertools.first_true (return first true item in iterable)

2013-08-23 Thread Radu Voicilas

Changes by Radu Voicilas radu.voici...@gmail.com:


--
nosy: +raduv

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I just applied the dict version of dummy to sets in 
http://hg.python.org/cpython/rev/f0202c3daa7a
and it unexpectedly broke test_gdb again:

FAIL: test_sets (test.test_gdb.PrettyPrintTests)
Verify the pretty-printing of sets
--
Traceback (most recent call last):
  File 
/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_gdb.py,
 line 319, in test_sets
self.assertEqual(gdb_repr, {'b'})
AssertionError: {dummy key type at remote 0x103b35c0, 'b'} != {'b'}
- {dummy key type at remote 0x103b35c0, 'b'}
+ {'b'}



Antoine, can you see what the issue is?  Why does this show as the dummy key 
type instead of being recognized as the object returned by _PySet_Dummy?   I'm 
not sure why this works for dicts, but not for sets.

--
assignee: rhettinger - pitrou
status: closed - open

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



[issue18821] Add .lastitem attribute to takewhile instances

2013-08-23 Thread Oscar Benjamin

New submission from Oscar Benjamin:

I've often wanted to be able to query a takewhile object to discover the item 
that failed the predicate but the item is currently discarded.

A usage example:

def sum(items):
it = iter(items)
ints = takewhile(Integral.__instancecheck__, it)
subtotal = sum(ints)
if not hasattr(ints.lastitem):
return subtotal
floats = takewhile(float.__instancecheck__, it)
subtotalf = fsum(floats)
if not hasattr(floats.lastitem):
return subtotal + subtotalf
# Deal with more types
...


Loosely what I'm thinking is this but perhaps with different attribute names:


class takewhile(pred, iterable):
def __init__(self):
self.pred = pred
self.iterable = iterable
self.failed = False
def __iter__(self):
for item in self.iterable:
if self.pred(item):
yield item
else:
self.failed = True
self.lastitem = item
return

--
components: Library (Lib)
messages: 195962
nosy: oscarbenjamin
priority: normal
severity: normal
status: open
title: Add .lastitem attribute to takewhile instances
type: enhancement
versions: Python 3.4

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Checking for dummies in dicts in python-gdb.py is implicit (see 
PyDictObjectPtr.iteritems()): entries whose value is NULL are not printed.

Set entries do not have values, so instead pySetObjectPtr.write_repr() uses a 
hack with the repr() of the key to check for dummies. Instead I think we should 
re-use the approach in my patch: publish the dummy object as a (private) C API 
so that python-gdb.py can simply compare the key pointer by equality.

--

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



[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Brett Cannon

Brett Cannon added the comment:

Because that is how it has always been: 
http://hg.python.org/cpython/file/b9b521efeba3/Python/import.c#l3164 . It could 
be changed but someone out there is relying on those semantics and it's a minor 
thing to leave in so I don't want to mess with it.

--
resolution:  - rejected
status: open - closed

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Attaching a patch, but I don't have a way to test it.

--
Added file: http://bugs.python.org/file31438/fix_dummy.diff

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



[issue18713] Clearly document the use of PYTHONIOENCODING to set surrogateescape

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

With new subject this issue looks as a duplicate of (or tightly related to) 
issue12832.

--

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In Python 3 ascii() uses the backslashreplace error handler.

 class T:
... def __repr__(self):
... return '\u20ac\udcff'
... 
 print(ascii(T()))
\u20ac\udcff

I think using the backslashreplace error handler in repr() in Python 2.7 is 
good solution. Here is a patch.

--
keywords: +patch
nosy: +serhiy.storchaka
stage: test needed - patch review
Added file: http://bugs.python.org/file31439/unicode_repr.patch

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



[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Rob Bairos

Rob Bairos added the comment:

However, if it fails __import()__  it doesn't get to the sys.modules[] call 
anyways.

The only case affected by this are:

  PASS the __import()__ call, 
  then FAIL the sys.modules[] lookup afterwards.

Why will that effect anything currently out there?

As it stands now, it suppresses development of some types of dynamic 
hierarchies of modules such as we've implemented, that don't register 
themselves in sys.modules[]

--

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Checking repr() perpetuates the original hack so, why it may work, I think it's 
better if we take the opportunity to solve it cleanly.
I'll try to take a look tonight (I suppose you're under Windows?).

--

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

This change is going to break backward compatibility. I don't think
that it can be done in Python 2.7.x, and there is no Python 2.8 (PEP
404).

--

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



[issue18816] mmap.flush() is always synchronous, hurting performance

2013-08-23 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Depending of a concrete OS implementation is not good. Linux is not the only OS 
out there, and I have very old machines in production yet:


# uname -a
Linux colquide..es 2.4.37 #4 Fri Dec 12 01:10:45 CET 2008 i686 unknown


I have been hit by the VM/file cache split in the past. Portability is 
important.

Anyway, the Python mmap manual says that mmap.flush() is needed to be sure 
that you are not going to lose changes you made in the mmap. On modern OSs 
it is not actually needed, as you say, and the performance hit is important 
enough for me to investigate and write this enhancement proposal :).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18816
___
___
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-08-23 Thread Zachary Ware

Zachary Ware added the comment:

Ping!

The buildbots still seem to be failing, are my proposed fixes acceptable?  Both 
patches still apply cleanly.

--

___
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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread Drekin

Drekin added the comment:

This patch introduces a bit ugly traceback. Shouldn't there be “raise from 
None” or “raise from previous_exc” instead of simple raise?

--
nosy: +Drekin

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



[issue18811] add ssl-based generator to random module

2013-08-23 Thread Christian Heimes

Christian Heimes added the comment:

I don't get it either. urandom is perfectly fine. I showed that urandom is just 
a bit slower than SSL_rand().

How about we generalize SystemRandom so  users can implement a custom RNG class 
wby providing a method rng(amount) - bytes?

Antoine Pitrou rep...@bugs.python.org schrieb:

Antoine Pitrou added the comment:

Seriously, why are we obsessed with performance when talking about a
security feature? Did anyone *actually* complain about urandom() being
too slow (ok, someone complained about it eating file descriptors...
:-))?

The question is whether OpenSSL's random generator produces better
randomness than the system one: apparently it's not the case under
Linux, how about other systems?

--

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

--

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



[issue18811] add ssl-based generator to random module

2013-08-23 Thread Charles-François Natali

Charles-François Natali added the comment:

 How about we generalize SystemRandom so  users can implement
 a custom RNG class wby providing a method rng(amount) - bytes?

The random module already makes it easy:

Class Random can also be subclassed if you want to use a different basic 
generator of your own devising: in that case, override the random(), seed(), 
getstate(), and setstate() methods. Optionally, a new generator can supply a 
getrandbits() method — this allows randrange() to produce selections over an 
arbitrarily large range.


 I showed that urandom is just a bit slower than SSL_rand().

Just a bit is relative, I read from 2 to 3 times slower, on Linux.

 I don't get it either. urandom is perfectly fine.

Alright, closing then.

--
resolution:  - rejected
stage: needs patch - committed/rejected
status: open - closed

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



[issue18811] add ssl-based generator to random module

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 How about we generalize SystemRandom so  users can implement a custom
 RNG class wby providing a method rng(amount) - bytes?

We may make it easier to implement custom Random implementations with
user-defined random generators, but they needn't be *SystemRandom*
subclasses ;-)

--

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



[issue18326] Mention 'keyword only' for list.sort, improve glossary.

2013-08-23 Thread Zachary Ware

Zachary Ware added the comment:

How about a combination of the two?  It's still short, but gets the point 
across without assuming the reader knows exactly what 'keyword-only argument' 
or requiring further reading, while introducing the term and providing the link 
for deeper understanding.

(Here's the relevant change in this patch, the rest is the same:)

+  :meth:`sort` accepts two arguments that must be passed by keyword
+  (:ref:`keyword-only arguments keyword-only_parameter`):

--
Added file: http://bugs.python.org/file31440/issue18326.v3.diff

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



[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Brett Cannon

Brett Cannon added the comment:

If I were to change this code in any way it would be to stop passing in a dummy 
value for fromlist, not stop pulling from sys.modules. The official idiom for 
directly calling __import__() is::

  __import__(module_name)
  return sys.modules[module_name]

It just so happens PyImport_Import() is old enough to be using both the old 
idiom of a bogus fromlist item *and* been updated at some point to use the new 
idiom.

I would also strongly discourage you from replacing __import__. More and more 
code is using importlib and various importers to do things and so it might have 
unforeseen consequences. importlib.import_module() also relies on 
importlib.__import__, not builtins.__import__ so as more code switches to that 
function for dynamic importing it will lead to more imports not using an 
overridden __import__.

--

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



[issue17400] ipaddress.is_private needs to take into account of rfc6598

2013-08-23 Thread Freek Dijkstra

Freek Dijkstra added the comment:

Peter, first of all, thanks for your library. I didn't mention that before, but 
should have.


I'm in favour of a pragmatic approach. I've only come across NATing for RFC 
1918 and RFC 6598 addresses. While it can technically be done for other 
addresses, and is allowed by RFC 3022 section 5.1, I have never seen that in 
practice.

is_natted() (or perhaps: is_nattable()?) could be used by a SIP client to 
decide if it should include a VIA header or not, without need to do a 
resource-expensive NAT check at all times.

To be clear: I'm not a great fan of is_natted() myself, but I fear that keeping 
is_private() the way it is, people will use it as if it meant is_natted() and 
will end up with unintended errors in their code.


is_forward and is_global -if deemed useful- should just follow the columns at 
http://www.iana.org/assignments/iana-ipv4-special-registry and 
http://www.iana.org/assignments/iana-ipv6-special-registry. Perhaps functions 
like is_valid_source(), is_valid_destination() and is_reserved() may be 
included too.

The meaning of these columns is explained in 
[http://tools.ietf.org/html/rfc6890#section-2.2.1 RFC 6890]. I interpret 
forwardable as should be forwarded by a router and global as may be seen on 
the Internet / should be forwarded beyond administrative domain boundaries. 
For example, private IP addresses or benchmarking IP addresses may be routed 
just fine, as long as they're never seen on the global Internet.

PS: There is a typo in the documentation. is_unspecified mentions RFC 5375, but 
that should be RFC 5735, which in turn is obsoleted by RFC 6890. I'll see if I 
can make a patch, but that will be after my holiday.

--

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



[issue17400] ipaddress.is_private needs to take into account of rfc6598

2013-08-23 Thread STINNER Victor

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


--
nosy:  -haypo

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

This patch introduces a bit ugly traceback. Shouldn't there be “raise from 
None” or “raise from previous_exc” instead of simple raise?

Oh, I see.

 os.environb[b'10']
Traceback (most recent call last):
  File /home/vstinner/prog/python/default/Lib/os.py, line 648, in __getitem__
value = self._data[self.encodekey(key)]
KeyError: b'10'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/vstinner/prog/python/default/Lib/os.py, line 651, in __getitem__
raise KeyError(key)
KeyError: b'10'

Attached patch adds from None.

--
resolution: fixed - 
status: closed - open
Added file: http://bugs.python.org/file31441/os_environb_raise_from_none.patch

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



[issue17326] Windows build docs still referring to VS 2008 in 3.3

2013-08-23 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
versions: +Python 3.4

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread Drekin

Drekin added the comment:

It's also in __delitem__.

--

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



[issue18571] Implementation of the PEP 446: non-inheritable file descriptors

2013-08-23 Thread STINNER Victor

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


Removed file: http://bugs.python.org/file31413/775890a666bf.diff

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



[issue18755] imp read functions do not try to re-open files that have been closed from previous reads

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ddd610cb65ef by Brett Cannon in branch '3.3':
Issue #18755: Allow imp.load_*() loaders to have get_data() called
http://hg.python.org/cpython/rev/ddd610cb65ef

New changeset b107f7a8730d by Brett Cannon in branch '3.3':
NEW entry for issue #18755
http://hg.python.org/cpython/rev/b107f7a8730d

New changeset 7d30ecf5c916 by Brett Cannon in branch 'default':
merge for issue #18755
http://hg.python.org/cpython/rev/7d30ecf5c916

New changeset 174bfa137472 by Brett Cannon in branch 'default':
merge for issue #18755
http://hg.python.org/cpython/rev/174bfa137472

--
nosy: +python-dev

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



[issue13758] compile() should not encode 'filename' (at least on Windows)

2013-08-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Victor, do you have any opinion on this unicode filename issue?

--
nosy: +haypo

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



[issue18755] imp read functions do not try to re-open files that have been closed from previous reads

2013-08-23 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue18821] Add .lastitem attribute to takewhile instances

2013-08-23 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +rhettinger

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



[issue18623] Factor out the _SuppressCoreFiles context manager

2013-08-23 Thread Valerie Lambert

Valerie Lambert added the comment:

Of course, here is the patch without the '--git' option.

--
Added file: http://bugs.python.org/file31442/issue-18623_v2.patch

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



[issue18767] csv documentation does not note default quote constant

2013-08-23 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue18769] argparse remove subparser

2013-08-23 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue18783] No more refer to Python long

2013-08-23 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue18804] pythorun.c: is_valid_fd() should not duplicate the file descriptor

2013-08-23 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue18760] Fix internal doc references for the xml package

2013-08-23 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

How it can break backward compatibility? Currently repr() just raises 
UnicodeEncodeError.

UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 
0: ordinal not in range(128)

With patch it always returns 8-bit string. As far as repr() usually used for 
debugging the second alternative looks more helpful.

--

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

 How it can break backward compatibility? Currently repr() just raises 
 UnicodeEncodeError.

It depends on sys.getdefaultencoding() which can be modified in the site module 
(or in a PYTHONSTARTUP script) using sys.setdefaultencoding(). It should not 
possible to change the default encoding, and it was fixed in Python 3.

--

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 26c049dc1a4a by Victor Stinner in branch '3.3':
Close #17702: On error, os.environb now removes suppress the except context
http://hg.python.org/cpython/rev/26c049dc1a4a

New changeset 01f33959ddf6 by Victor Stinner in branch 'default':
(Merge 3.3) Close #17702: On error, os.environb now removes suppress the except
http://hg.python.org/cpython/rev/01f33959ddf6

--
resolution:  - fixed
status: open - closed

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



[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

 This patch introduces a bit ugly traceback.

It is now fixed, thanks for the report!

--

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



[issue18586] Allow running benchmarks for Python 3 from same directory

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b868d0a9c5d7 by Brett Cannon in branch 'default':
Issue #18586: Remove the need for make_perf3.sh
http://hg.python.org/benchmarks/rev/b868d0a9c5d7

--
nosy: +python-dev

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



[issue18586] Allow running benchmarks for Python 3 from same directory

2013-08-23 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


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

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 79007c4244d6 by Barry Warsaw in branch '2.6':
- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes
http://hg.python.org/cpython/rev/79007c4244d6

--

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Armin Rigo

Armin Rigo added the comment:

@Serhiy: it would certainly break a program that tries to call the repr() and 
catches the UnicodeEncodeError to do something else, like encode the data 
differently.

--

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

2013-08-23 Thread Charles-François Natali

Charles-François Natali added the comment:

Here's a patch with a more robust test: the previous test worked, but assume 
that only stdin, stdout and stderr FDs would be open in the child process. This 
might not hold anymore in a near future (/dev/urandom persistent FD).
The new test is much more robust.

--
stage: patch review - commit review
Added file: http://bugs.python.org/file31443/subprocess_close-default-1.diff

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand why os.dup2() is more reliable than os.pipe() for a unit 
test?

Is subprocess_close-default-1.diff portable? test_os uses hasattr(os, dup2). 
In Modules/posixmodule.c, it looks like the function is always defined!?

--

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



[issue17213] ctypes loads wrong version of C runtime, leading to error message box from system

2013-08-23 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
nosy: +asvetlov

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

.__repr__() is not really allowed to return Unicode objects in Python 2.x. If 
you do this, you're on your own. The CPython internals try to convert any 
non-str object to a str object, but this is only done to assure that 
PyObject_Repr() always returns a str object.

I'd suggest closing this as won't fix.

--

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



[issue18772] Fix gdb plugin for new sets dummy object

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Attached patch solves the issue and removes the repr()-based hack in the gdb 
plugin.

--
Added file: http://bugs.python.org/file31444/gdb_sets_repr2.patch

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



[issue18822] poor proxyval() coverage in test_gdb

2013-08-23 Thread Antoine Pitrou

New submission from Antoine Pitrou:

The proxyval() of many built-in types doesn't seem covered by test_gdb, as 
write_repr() is specialized for most of them.

(check: add 1/0 to one of those proxyval() implementations and watch test_gdb 
succeed)

--
components: Tests
messages: 195998
nosy: dmalcolm, pitrou
priority: normal
severity: normal
status: open
title: poor proxyval() coverage in test_gdb
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18808] Thread.join returns before PyThreadState is destroyed

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch for 3.3/3.4.

--
keywords: +patch
stage: needs patch - patch review
versions:  -Python 2.7
Added file: http://bugs.python.org/file31445/subinterp_threads.patch

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

2013-08-23 Thread Charles-François Natali

Charles-François Natali added the comment:

 I don't understand why os.dup2() is more reliable than os.pipe() for a unit
 test?

I use dup2() because it allows me to specify a target FD, so the
parent can know precisely which FD was opened by the preexec hook, and
check it's closed in the child process. With pipe(), the FDs returned
are arbitrary, so the parent can't check them explicitly, and has to
check that no FD  2 is open in the child, which is fragile.

 Is subprocess_close-default-1.diff portable? test_os uses hasattr(os,
 dup2). In Modules/posixmodule.c, it looks like the function is always
 defined!?

Maybe it's not available on Windows, but it's definitely available on Unix.

--

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



[issue18763] subprocess: file descriptors should be closed after preexec_fn is called

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

the parent can know precisely which FD was opened by
the preexec hook, and check it's closed in the child process.

Oh ok, I see:

+self.assertNotIn(fd, remaining_fds)

You might also add a check:

self.assertLessEqual(remaining_fds, {0, 1, 2})

--

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



[issue11619] On Windows, don't encode filenames in the import machinery

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

I reopen the issue because some users are now requesting this feature.

I updated  parser_unicode.patch to the last Python version. The new patch has 
just a minor nit: test_symtable does crash :-D

I will investigate the crash later.

--
resolution: wont fix - 
status: closed - open
Added file: http://bugs.python.org/file31446/parser_unicode-2.patch

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

 I'd suggest closing this as won't fix.

Agreed, it's time to upgrade to Python 3!

--
resolution:  - fixed
status: open - closed

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



[issue18776] atexit error display behavior changed in python 3

2013-08-23 Thread Antoine Pitrou

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


--
stage: patch review - needs patch

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



[issue18760] Fix internal doc references for the xml package

2013-08-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Serhiy, you forgot to attach the patch.

--
type:  - enhancement

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



[issue13758] compile() should not encode 'filename' (at least on Windows)

2013-08-23 Thread STINNER Victor

STINNER Victor added the comment:

 Victor, do you have any opinion on this unicode filename issue?

I closed the issue #11619 in january 2013 before there was no user requesting 
the feature. I just reopened the issue because users now ask for it.

--

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



[issue18774] There is still last bit of GNU Pth code in signalmodule.c

2013-08-23 Thread Ezio Melotti

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


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

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



[issue17618] base85 encoding

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Serhiy, Martin, is one of you still working on this?

--

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



[issue18818] Empty PYTHONIOENCODING is not the same as nonexistent

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch with tests and documentation. For the documentation I hope on 
your help.

--
Added file: http://bugs.python.org/file31447/empty_pythonioencoding_3.patch

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 It depends on sys.getdefaultencoding() which can be modified in the site 
 module (or in a PYTHONSTARTUP script) using sys.setdefaultencoding().

Of course. Every successful without patch repr() will left same with patch. 
However the patch allows you to see objects which were not repr-able before. 
repr() itself is used in the formatting of error messages, so it is desirable 
extend its aplicability as far as possible.

 @Serhiy: it would certainly break a program that tries to call the repr() and 
 catches the UnicodeEncodeError to do something else, like encode the data 
 differently.

Why it would break? You want encode the data differently.only due non-working 
repr(), however with proposed patch this will be just not needed.

 .__repr__() is not really allowed to return Unicode objects in Python 2.x. If 
 you do this, you're on your own.

PyObject_Repr() contains a code which converts unicode to str and raise an 
exception if __repr__() result is not str or unicode. Unicode __repr__() is 
expected even if it is not recommended.

--

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



[issue18817] Got resource warning when running Lib/aifc.py

2013-08-23 Thread Serhiy Storchaka

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


--
stage:  - patch review

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



[issue18817] Got resource warning when running Lib/aifc.py

2013-08-23 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka
priority: normal - low

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



[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0e9ba7b26d5 by Brett Cannon in branch 'default':
Issue #18394: Explicitly close the file object cgi.FieldStorage
http://hg.python.org/cpython/rev/c0e9ba7b26d5

--
nosy: +python-dev

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



[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-23 Thread Brett Cannon

Brett Cannon added the comment:

I managed to write a similar patch to Vajrasky independently, so at least I 
know the approach is reasonable. =)

I'm not backporting since it really isn't that critical; I fixed it just to 
turn off the ResourceWarning while running the test suite.

--
nosy: +brett.cannon
resolution:  - fixed
status: open - closed
versions:  -Python 3.3

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



[issue18760] Fix internal doc references for the xml package

2013-08-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry. Can't believe I done it again.

--
keywords: +patch
Added file: http://bugs.python.org/file31448/refs.xml.diff

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



[issue7732] imp.find_module crashes Python if there exists a directory named __init__.py

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Seems fixed now.

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

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



[issue18757] Fix internal references for concurrent modules

2013-08-23 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM.

--
stage: patch review - commit review

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



[issue5876] __repr__ returning unicode doesn't work when called implicitly

2013-08-23 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Serhiy Storchaka wrote:
 .__repr__() is not really allowed to return Unicode objects in Python 2.x. 
 If you do this, you're on your own.
 
 PyObject_Repr() contains a code which converts unicode to str and raise an 
 exception if __repr__() result is not str or unicode. Unicode __repr__() is 
 expected even if it is not recommended.

True, but the code is not intended to support non-ASCII Unicode,
otherwise we would have taken care to introduce support for this
much earlier in the 2.x series.

--

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



[issue18795] pstats - allow stats sorting by cumulative time per call and total time per call

2013-08-23 Thread Ezio Melotti

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


--
nosy: +georg.brandl
stage:  - patch review

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



[issue18796] Wrong documentation of show_code function from dis module

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 64678369c4d0 by Ezio Melotti in branch 'default':
#18796: improve documentation of the file argument of dis.show_code.  Initial 
patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/64678369c4d0

--
nosy: +python-dev

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



[issue18796] Wrong documentation of show_code function from dis module

2013-08-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the report and the patch!

--
assignee: docs@python - ezio.melotti
nosy: +ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - enhancement

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



[issue18756] os.urandom() fails under high load

2013-08-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, you're gonna laugh, the simplified patch has a complication (not 
theoretical, it would trip test_cmd_line). Attaching patch.

--
Added file: http://bugs.python.org/file31449/persistent_urandom_fd4.patch

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



[issue18810] Stop doing stat calls in importlib.machinery.FileFinder to see if something is a file or folder

2013-08-23 Thread Eric Snow

Eric Snow added the comment:

Isn't this related somewhat to #7732?

--
nosy: +eric.snow

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



[issue18798] Typo and unused variables in test fcntl

2013-08-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the report and the patch!

--
assignee:  - ezio.melotti
nosy: +ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - enhancement
versions: +Python 2.7, Python 3.3

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



[issue18798] Typo and unused variables in test fcntl

2013-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d7bac470951b by Ezio Melotti in branch '2.7':
#18798: fix typo in test_fcntl.  Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/d7bac470951b

New changeset 41c90b8f49d9 by Ezio Melotti in branch '3.3':
#18798: fix typo in test_fcntl.  Patch by Vajrasky Kok.
http://hg.python.org/cpython/rev/41c90b8f49d9

New changeset 0f8f5fd6e712 by Ezio Melotti in branch 'default':
#18798: merge typo fix from 3.3 and also use two unused variables.
http://hg.python.org/cpython/rev/0f8f5fd6e712

--
nosy: +python-dev

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



  1   2   >