[issue19920] TarFile.list() fails on some files

2013-12-17 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the preliminary patch.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file33173/fix_tarfile_list_print_lone_surrogate.patch

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-17 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I based my implementation on this statement:

Guido pointed out that it may more useful to resolve the path components until 
one doesn't exist

until one doesn't exist in this case means P(BASE, 'foo', 'in', 'spam') 
resolves until BASE / 'foo'.

If different spec is better, I'll change the implementation.

--

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



[issue19894] zipfile ignores deflate level settings in zipinfo object

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is new feature and can be added only in 3.5.

--
assignee: docs@python - 
components:  -Documentation, Tests
stage: patch review - needs patch
type: behavior - enhancement
versions: +Python 3.5 -Python 2.7

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



[issue19717] resolve() fails when the path doesn't exist

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I believe Guido meant one of standard strategies. Current posixpath.realpath() 
implementation conforms --canonicalize-missing.
It is not clear which two strategies (from three) should be used in 
Path.resolve().

--

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



[issue19385] dbm.dumb should be consistent when the database is closed

2013-12-17 Thread Claudiu.Popa

Claudiu.Popa added the comment:

If we agree that this should be fixed in 3.4, can somebody commit it before the 
second beta?

--

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



[issue20000] SSLContext.get_ca_certs() and self-signed certs

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 get_ca_certs() doesn't return the cert although it is used to
 successfully validate a remote cert.

Interesting. Is it because of the way you implemented get_ca_certs()?

 I propose to modify and rename the function and to add a check_ca to
 the dict that is returned by getpeercert().

Can you explain? What does check_ca mean?

--
nosy: +pitrou

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread Peter Otten

New submission from Peter Otten:

I ran into this when trying to trigger rereading the column names with

$ cat tmp.csv
alpha,beta
1,2
gamma,delta,epsilon
3,4,5
$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08) 
[GCC 4.6.1] on linux2
Type help, copyright, credits or license for more information.
 import csv
 with open(tmp.csv) as f:
... reader = csv.DictReader(f)
... for i in range(2):
... print next(reader)
... reader.fieldnames = None
... 
{'alpha': '1', 'beta': '2'}
Traceback (most recent call last):
  File stdin, line 4, in module
  File /usr/lib/python2.7/csv.py, line 112, in next
d = dict(zip(self.fieldnames, row))
TypeError: zip argument #1 must support iteration

reader = csv.DictReader(...)
...
reader.fieldnames = None

I think the easiest fix would be to have it inherit from object:

 class DictReader(csv.DictReader, object): pass
... 
 with open(tmp.csv) as f:
... reader = DictReader(f)
... for i in range(2):
... print next(reader)
... reader.fieldnames = None
... 
{'alpha': '1', 'beta': '2'}
{'3': 'gamma', '5': 'epsilon', '4': 'delta'}

--
messages: 206418
nosy: peter.otten
priority: normal
severity: normal
status: open
title: csv.DictReader classic class has a property with setter
versions: Python 2.7

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



[issue19997] imghdr.what doesn't accept bytes paths

2013-12-17 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Thanks, Vajrasky, I forgot about the fact that open can open file descriptors. 
Here's a patch which fixes this, also adds a test for BytesIO and uses 
os.fsencode instead of .encode().

--
Added file: http://bugs.python.org/file33174/imghdr_files.patch

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, fixed test case attached. Turns out the ipython workaround test was 
completely wrong and never even loaded multiprocessing, and hence always 
passed, even with the workaround disabled. So I fixed that test case, and used 
the same approach for the zipfile, directory and package tests. I also fixed 
the submodule test to check that explicit relative imports work properly from 
__mp_main__ in the child processes.

With this updated test cast, the v2 patch handles everything correctly, but 
there are 4 failures on Linux without the patch. Specifically:

- test_basic_script_no_suffix fails for the spawn and forkserver start methods 
(the child processes fail to find a spec for __mp_main__)
- test_module_in_package fails for the spawn and forkserver start methods (the 
explicit relative import from __mp_main__ fails because the import system isn't 
initialised correctly in the child processes)

The former case is the one Olivier reported in this issue. It's a new case for 
3.4, since the spawn start method was previously only available on Windows, 
where scripts always have an extension.

The latter edge case is the one my XXX (ncoghlan): The following code makes 
several bogus assumptions regarding the relationship between __file__ and a 
module's real name. comment was about.

I believe we could actually adjust earlier versions to handle things as well as 
this new PEP 451 based approach (by using a combination of __package__ and 
__file__ rather than __spec__), but that's much harder for me to work on in 
those versions where the spawn start method is only available on Windows :)

--
Added file: 
http://bugs.python.org/file33175/test_multiprocessing_main_handling.py

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



[issue17825] Indentation.offset and SyntaxError.offset mismatch

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

patch_indenterror_offset_v2.diff LGTM.

--
stage:  - commit review
versions: +Python 2.7, Python 3.3

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: 
http://bugs.python.org/file33161/test_multiprocessing_main_handling.py

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: 
http://bugs.python.org/file33146/issue19946_pep_451_multiprocessing.diff

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. But err_flag is not needed, valid error numbers are all nonzero.

--
assignee:  - serhiy.storchaka
stage: needs patch - commit review

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



[issue20000] SSLContext.get_ca_certs() and self-signed certs

2013-12-17 Thread Christian Heimes

Christian Heimes added the comment:

 Interesting. Is it because of the way you implemented get_ca_certs()?

Yes, it's the line

  http://hg.python.org/cpython/file/b78de8029606/Modules/_ssl.c#l3103

that skips all certs that are not recognized as CA certs. I wasn't aware
that OpenSSL supports self-signed certs that way.

 Can you explain? What does check_ca mean?

The return value of X509_check_ca().

http://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=crypto/x509v3/v3_purp.c;h=6c40c7dfc318e4b46fc20d38581ad3656e344b5e;hb=HEAD#l517

--

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



[issue20000] SSLContext.get_ca_certs() and self-signed certs

2013-12-17 Thread Antoine Pitrou

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


--
versions: +Python 3.5 -Python 3.4

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b6d6f3b4b100 by Nick Coghlan in branch 'default':
Close #19946: use runpy as needed in multiprocessing
http://hg.python.org/cpython/rev/b6d6f3b4b100

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

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


Removed file: 
http://bugs.python.org/file33163/test_multiprocessing_main_handling.py

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



[issue20005] Minor typo in operator documentation

2013-12-17 Thread Claudiu.Popa

Changes by Claudiu.Popa pcmantic...@gmail.com:


--
assignee: docs@python
components: Documentation
files: typo_operator.patch
keywords: patch
nosy: Claudiu.Popa, docs@python
priority: normal
severity: normal
status: open
title: Minor typo in operator documentation
versions: Python 3.4
Added file: http://bugs.python.org/file33176/typo_operator.patch

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



[issue19700] Update runpy for PEP 451

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

On second thoughts, I'm going to close this one - if further runpy changes are 
needed to resolve issue 19702 (using __spec__.name for pickle when 
appropriate), let's deal with them there.

--
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed
type:  - enhancement

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



[issue19702] Update pickle to take advantage of PEP 451

2013-12-17 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
title: Update pickle to PEP 451 - Update pickle to take advantage of PEP 451

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 33c27b76a4d0 by Serhiy Storchaka in branch '2.7':
Issue #17976: Fixed potential problem with file.write() not detecting IO error
http://hg.python.org/cpython/rev/33c27b76a4d0

--
nosy: +python-dev

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



[issue19702] Update pickle to PEP 451

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Issue 19700 means that runpy now ensures that __main__.__spec__ is set 
appropriately when __main__ is executed via the import system.

Issue 19946 means that multiprocessing now ensures that __main__ is configured 
correctly in child processes to reference a properly initialised fake main to 
allow pickle compatibility with classes and functions defined in __main__ 
outside if __name__ == '__main__' guards.

The proposal here is that we make the following changes:

- runpy will ensure that when __main__ is executed via the import system, it 
will also be aliased in sys.modules as __spec__.name
- if __main__.__spec__ is set, pickle will use __spec__.name rather than 
__name__ to pickle classes, functions and methods defined in __main__
- multiprocessing is updated appropriately to skip creating __mp_main__ in 
child processes when __main__.__spec__ is set in the parent process

While I still think this is a reasonable idea, I think it qualifies as a new 
feature, and hence is better postponed to Python 3.5

--
dependencies: +Handle a non-importable __main__ in multiprocessing
nosy: +larry
versions: +Python 3.5 -Python 3.4

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Jaakko Moisio for your report and patch.

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

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



[issue9325] Add an option to pdb/trace/profile to run library module as a script

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Issue 19982 suggests a different way of refactoring the runpy APIs inspired by 
PEP 451: passing in a target module to be used, rather than creating a 
temporary one from scratch.

--

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



[issue19982] Add a target parameter to runpy.run_path and runpy.run_module

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Implementing this is actually likely to require non-trivial restructuring of 
the runpy internals. contextlib.ExitStack may prove useful in making it easier 
to programmatically select amongst different context managers.

The __mp_main__ helpers in multiprocessing should also be able to take 
advantage of this once it is available, and it may prove useful in finally 
providing -m analogues for pdb etc that play nice when an exception occurs (see 
issue 9325).

--

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 237deaf9ba64 by Serhiy Storchaka in branch '2.7':
Skip test for issue #17976 if /dev/null is not available.
http://hg.python.org/cpython/rev/237deaf9ba64

--

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



[issue14228] It is impossible to catch sigint on startup in python code

2013-12-17 Thread Yongzhi Pan

Changes by Yongzhi Pan fossi...@users.sourceforge.net:


--
nosy: +fossilet

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



[issue16404] Uses of PyLong_FromLong that don't check for errors

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset debdfa44f020 by Serhiy Storchaka in branch '2.7':
Issue #16404: Add checks for return value of PyInt_FromLong() in
http://hg.python.org/cpython/rev/debdfa44f020

New changeset 928c0acf7c09 by Serhiy Storchaka in branch '3.3':
Issue #16404: Add checks for return value of PyLong_FromLong() in
http://hg.python.org/cpython/rev/928c0acf7c09

New changeset d489394a73de by Serhiy Storchaka in branch 'default':
Issue #16404: Add checks for return value of PyLong_FromLong() in
http://hg.python.org/cpython/rev/d489394a73de

--
nosy: +python-dev

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



[issue16404] Uses of PyLong_FromLong that don't check for errors

2013-12-17 Thread Serhiy Storchaka

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


--
resolution:  - fixed
stage: patch review - committed/rejected

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



[issue992389] attribute error due to circular import

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm reopening this, since PEP 451 opens up new options for dealing with it (at 
least for loaders that export the PEP 451 APIs rather than only the legacy 
loader API, which now includes all the standard loaders other than the ones for 
builtins and extension modules)

The attached patch doesn't have an automated test and is quite rough around the 
edges (as the additional check for the parent being in sys.modules confuses a 
couple of the importlib tests), but it proves the concept by making the 
following work:

[ncoghlan@lancre py3k]$ cd ../play
[ncoghlan@lancre play]$ mkdir issue992389
[ncoghlan@lancre play]$ cat  issue992389/mod.py
from . import mod
print(Success!)
[ncoghlan@lancre play]$ python3 -c import issue992389.mod
Traceback (most recent call last):
  File string, line 1, in module
  File ./issue992389/mod.py, line 1, in module
from . import mod
ImportError: cannot import name mod
[ncoghlan@lancre play]$ ../py3k/python -c import issue992389.mod
Success!

--
keywords: +patch
nosy: +larry
resolution: duplicate - 
status: closed - open
superseder: Modify IMPORT_FROM to fallback on sys.modules - 
versions: +Python 3.4 -Python 3.3
Added file: 
http://bugs.python.org/file33177/issue992389_set_parent_module_attribute.diff

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

With PEP 451 implemented, note that I have reopened issue 992389 - the patch to 
set the parent module attribute at the same time as setting the sys.module 
attribute is actually pretty trivial for the PEP 451 loader case, and that now 
includes all the standard loaders.

I also think that approach will have fewer weird edge cases than this version.

--

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

test_weakset often fails on FreeBSD. Fo example see 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%202.7/builds/285/steps/test/logs/stdio.

test test_weakset failed -- Traceback (most recent call last):
  File 
/usr/home/buildbot/koobs-freebsd10/2.7.koobs-freebsd10/build/Lib/test/test_weakset.py,
 line 491, in test_weak_destroy_and_mutate_while_iterating
self.assertTrue(u in s)
AssertionError: False is not true

Second run of this test is successful.

--
messages: 206435
nosy: fdrake, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Sporadic failures of test_weakset
type: behavior
versions: Python 2.7

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread Eric V. Smith

Eric V. Smith added the comment:

I'm not clear on this: is this a new feature you'd like to see, or is this 
documented behavior of a DictReader that's not working?

If it's a new feature, the earliest it can be implemented is in 3.5.

--
nosy: +eric.smith

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread STINNER Victor

STINNER Victor added the comment:

(I was trying to report the issue upstream.)

--

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread STINNER Victor

STINNER Victor added the comment:

I played with fullwrite.c and now think that the fix is incomplete. fwrite() 
may succeed to write data into the buffer, but you may get the error on 
fflush() or fclose().

Try attached fullwrite2.c: fwrite() succeed (written=len, errno=result=0), 
whereas fclose() fails. If you enable fflush(), it will also fail.

Output:
---
fwrite(hello
) = 6 bytes written/6 [errno=0, ferror=0]
fclose() = -1 [errno=28]
---

The complete fix is maybe to write fflush() before fclose(), or at least raise 
an exception if fclose() returns a non-zero result. Correctly, file.close() 
returns a number in case of an error...

But now comes the question of backward compatibility, may such change break 
applications? It's maybe a nice thing to break applications if it warns users 
that they are going to loose data (USB key full, cannot write the whole 
important document!).

--
resolution: fixed - 
status: closed - open
Added file: http://bugs.python.org/file33178/fullwrite2.c

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Does it occur only on 2.7?

--

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



[issue19713] Deprecate various things in importlib thanks to PEP 451

2013-12-17 Thread Brett Cannon

Brett Cannon added the comment:

* Yes, you can commit with the warnings being triggered to get help with 
resolving them, just expect to potentially do a lot of work to make sure they 
don't leak out into 3.4 final.

* Just don't deprecate load_module() yet in code. If we can't even get rid of 
all our usage of the method then it isn't fair to expect users to do the same. 
Deprecating in the docs is fine, though.

--

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I can't reproduce the failure after more than 2000 test runs.
Also, this failure is weird: the test is supposed to be deterministic.

--
nosy: +koobs

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Does it occur only on 2.7?

Don't know.

--

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Are you have Python code which exposes a bug?

--

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread R. David Murray

R. David Murray added the comment:

Although this is clearly a bug, we've run into backward compatibility issues in 
the past with promoting stdlib classic classes to new style, so I'm not sure if 
the risk of fixing it is worth the benefit.  It is obviously not a problem in 
Python3.

Eric: I had to stare it for a while to see it...the problem is that because it 
is a classic class, the setter for fieldnames doesn't *work*, it just replaces 
the value of 'fieldnames' instead of setting self._fieldnames.

--
nosy: +r.david.murray

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, it seems the failure can happen because of hash randomization.

--

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Simon Sapin

New submission from Simon Sapin:

When given a file-like object, html5lib calls .read(0) in order to check if the 
result is bytes or Unicode:

https://github.com/html5lib/html5lib-python/blob/e269a2fd0aafcd83af7cf1e65bba65c0e5a2c18b/html5lib/inputstream.py#L434

When given the result of urllib.client.urlopen(), it parses an empty document 
because of this bug.

Test case:

 from urllib.request import urlopen
 response = urlopen('http://python.org')
 response.read(0)
b''
 len(response.read())
0

For comparison:

 response = urlopen('http://python.org')
 len(response.read())
20317

The bug is here:

http://hg.python.org/cpython/file/d489394a73de/Lib/http/client.py#l541

'if not n:' assumes that zero bytes have been read indicates EOF, which is 
not the case when we ask for zero bytes.

--
messages: 206446
nosy: ssapin
priority: normal
severity: normal
status: open
title: .read(0) on http.client.HTTPResponse drops the rest of the content
type: behavior

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread STINNER Victor

STINNER Victor added the comment:

 The complete fix is maybe to write fflush() before fclose(), or at least 
 raise an exception if fclose() returns a non-zero result. Correctly, 
 file.close() returns a number in case of an error...

Oh sorry, I missed the line if (sts == -1) ... which raises an error.

But I'm still unable to reproduce the glibc bug mentioned by Charles-François :

 Yeah, who's volunteering to report it to the glibc?

--
resolution:  - fixed
status: open - closed

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Simon Sapin

Simon Sapin added the comment:

Adding a proposed patch.

--
keywords: +patch
Added file: http://bugs.python.org/file33179/python-issue20007.diff

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Larry Hastings

Larry Hastings added the comment:

So all the PyRun_*Object functions are new in 3.4, and none of them are 
documented yet?

Option 4 is silly--I don't think we should ship them as public APIs in 3.4 if 
we're planning to rename them.  I prefer the previous options.

p.s. fwiw I hate ExName.

--

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



[issue19702] Update pickle to take advantage of PEP 451

2013-12-17 Thread Larry Hastings

Larry Hastings added the comment:

So far I agree that this should be postponed to 3.5.

--

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

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


--
components: +Tests
stage:  - patch review
versions: +Python 3.3, Python 3.4

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch. The failure doesn't occur on 3.x because of f189da5bda26, 
which clearly looks misled now.

--
assignee:  - pitrou
keywords: +patch
Added file: http://bugs.python.org/file33180/issue20006.patch

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Jaakko Moisio

Jaakko Moisio added the comment:

The new patch is fine as it is, but my logic behind using err_flag was the 
following: err_flag was set solely based on the inspection of return value of 
fwrite and ferror, without referencing to errno. It is of course true that at 
the same time errno is set to non-zero in any correct C standard library 
implementation (err_flag != 0 iff err != 0), but as the patch was originally 
for circumventing a bug in glibc, I decided to be use that extra flag for the 
purpose.

 But I'm still unable to reproduce the glibc bug mentioned by Charles-François 
 :

Yes. It seems that the bug in glibc has been fixed. But at least Python 2.7 is 
now a little bit better guarded against exotic file IO bugs that might emerge 
in C standard libraries :)

--

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 So all the PyRun_*Object functions are new in 3.4, and none of them are 
 documented yet?

Not all. Only following functions are new in 3.4:

Parser/parsetok.c:PyParser_ParseStringObject
Parser/parsetok.c:PyParser_ParseFileObject
Python/future.c:PyFuture_FromASTObject
Python/symtable.c:PySymtable_BuildObject
Python/compile.c:PyAST_CompileObject
Python/_warnings.c:PyErr_WarnExplicitObject
Python/ast.c:PyAST_FromNodeObject
Python/errors.c:PyErr_SyntaxLocationObject
Python/errors.c:PyErr_ProgramTextObject
Python/pythonrun.c:PyRun_InteractiveOneObject
Python/pythonrun.c:Py_CompileStringObject
Python/pythonrun.c:Py_SymtableStringObject
Python/pythonrun.c:PyParser_ASTFromStringObject
Python/pythonrun.c:PyParser_ASTFromFileObject

Following functions existed in 3.3:

Objects/moduleobject.c:PyModule_NewObject
Objects/moduleobject.c:PyModule_GetNameObject
Objects/moduleobject.c:PyModule_GetFilenameObject
Objects/abstract.c:PyObject_CallObject
Objects/bytesobject.c:PyBytes_FromObject
Objects/fileobject.c:PyFile_WriteObject
Objects/memoryobject.c:PyMemoryView_FromObject
Objects/longobject.c:PyLong_FromUnicodeObject
Objects/weakrefobject.c:PyWeakref_GetObject
Objects/exceptions.c:PyUnicodeEncodeError_GetObject
Objects/exceptions.c:PyUnicodeDecodeError_GetObject
Objects/exceptions.c:PyUnicodeTranslateError_GetObject
Objects/unicodeobject.c:PyUnicode_FromObject
Objects/unicodeobject.c:PyUnicode_FromEncodedObject
Objects/unicodeobject.c:PyUnicode_AsDecodedObject
Objects/unicodeobject.c:PyUnicode_AsEncodedObject
Objects/bytearrayobject.c:PyByteArray_FromObject
Python/sysmodule.c:PySys_GetObject
Python/sysmodule.c:PySys_SetObject
Python/errors.c:PyErr_SetObject
Python/errors.c:PyErr_SetFromErrnoWithFilenameObject
Python/import.c:_PyImport_FixupExtensionObject
Python/import.c:_PyImport_FindExtensionObject
Python/import.c:PyImport_AddModuleObject
Python/import.c:PyImport_ExecCodeModuleObject
Python/import.c:PyImport_ImportFrozenModuleObject
Python/import.c:PyImport_ImportModuleLevelObject
Python/modsupport.c:PyModule_AddObject
Python/pyarena.c:PyArena_AddPyObject

--

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Ah, it seems the failure can happen because of hash randomization.

Indeed. With -R switch 1/8 of tests are failed.

--

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Serhiy Storchaka

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


--
nosy: +orsenthil, serhiy.storchaka
stage:  - patch review
versions: +Python 2.7, Python 3.3, Python 3.4

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Larry Hastings

Larry Hastings added the comment:

Are all the functions that use Object to indicate Unicode object instead of 
string new in 3.4?  Of those, how many are undocumented?

--

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread Eric V. Smith

Eric V. Smith added the comment:

My (poorly phrased) question really was: is resetting fieldnames documented to 
force a re-read of the column headers? I don't see that it is, so I'm going to 
call this a 3.5 enhancement request.

I agree with David that we can't change DictReader to inherit from object in 
2.7 without risking some non-obvious failure. Who knows how people have derived 
from a DictReader, and what they're expecting to work?

If we do want this feature added, I'm not sure resetting fieldnames to None is 
an obvious interface. Maybe a reset_field_names(fieldnames=None) method, or 
something like it, would make more sense.

To accomplish this today, you can use various itertools functions to split up 
the input iterator and use two different DictReaders.

--
type:  - enhancement
versions: +Python 3.5 -Python 2.7

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread Peter Otten

Peter Otten added the comment:

Setting the fieldnames attribute of an existing DictReader is not documented. 
Eric, there is no need for an enhancement (other than for the documentation) as 
this already works in Python 3 where newstyle classes are the default. The 
heart of the bug is really the classic class with a property.

I have no idea what a fix could look like that is less intrusive than promoting 
DictReader to a newstyle class. 

Maybe it would be sufficient to add a comment to the code pointing to my bug 
report? I've already shown one workaround (object as a mixin); another would be 
to set the private _fieldnames rather than fieldnames so that the getter will 
continue to work as designed.

Looking at the current DictReader code and determining why and how it fails 
will be quite hard for a non-expert ;)

--

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Simon Sapin

Simon Sapin added the comment:

html5lib issue: https://github.com/html5lib/html5lib-python/issues/127

--

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Simon Sapin

Simon Sapin added the comment:

I could reproduce on 3.3.3 and tip, but not 3.2.3 or 2.7.6.

--
versions: +Python 3.5 -Python 2.7

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Are all the functions that use Object to indicate Unicode object instead
 of string new in 3.4?  Of those, how many are undocumented?

Following 5 functions work with PyObject* filenames and have Object-less 
variants which works with char * filenames:

Python/errors.c:PyErr_SetFromErrnoWithFilenameObject
Python/import.c:PyImport_AddModuleObject
Python/import.c:PyImport_ExecCodeModuleObject
Python/import.c:PyImport_ImportFrozenModuleObject
Python/import.c:PyImport_ImportModuleLevelObject

Private _PyImport_FixupExtensionObject and _PyImport_FindExtensionObject have 
no Object-less variants.

All other *Object functions are unrelated.

--

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 24a043355050 by Serhiy Storchaka in branch '2.7':
Circumventing a bug in glibc (issue #17976).
http://hg.python.org/cpython/rev/24a043355050

--

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Larry Hastings

Larry Hastings added the comment:

Are we proposing renaming any functions that are either
a) not new in 3.4, or
b) were documented as of 3.4 beta 1?

--

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



[issue17976] file.write doesn't raise IOError when it should

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Agree.

--

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Larry Hastings

Larry Hastings added the comment:

Are those five functions new in 3.4 and undocumented?

--

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



[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-17 Thread Guido van Rossum

Guido van Rossum added the comment:

AFAIK %i and %d are the same.

--

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



[issue19995] hex() and %x, oct() and %o do not behave the same

2013-12-17 Thread Eric V. Smith

Eric V. Smith added the comment:

Yes, looking through Objects/unicodeobject.c, 'u', 'i', and 'd' are treated the 
same everywhere.

--

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



[issue19518] Add new PyRun_xxx() functions to not encode the filename

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Are those five functions new in 3.4 and undocumented?

PyErr_SetFromErrnoWithFilenameObject exists even in 2.7. Other 4 
PyImport_*Object functions all added in 3.3 (see issue3080). All 5 functions 
are documented.

14 new functions were added in 3.4.

--

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



[issue19994] re.match does not return or takes long time

2013-12-17 Thread Matthew Barnett

Matthew Barnett added the comment:

It takes a long time due to excessive backtracking.

The regex implementation on PyPI finishes quickly because it contains some 
extra logic to reduce the chances of that happening, but it could be tricky 
trying to incorporate that into the existing re module.

Unless someone else wants have a go, it's probably best to mark this as won't 
fix.

--

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



[issue4130] Intel icc 9.1 does not support __int128_t used by ctypes

2013-12-17 Thread Jens Timmerman

Jens Timmerman added the comment:

sorry for my confusion, 

libffi's website stated

libffi-3.0.14 was released on TBD. 

I must have missed the TBD part.

--

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



[issue19994] re.match does not return or takes long time

2013-12-17 Thread Tim Peters

Tim Peters added the comment:

Closing this.  Since nobody else wants have a go over two decades so far, no 
point waiting for that ;-)

--
resolution: invalid - wont fix
stage:  - committed/rejected
status: open - closed

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread R. David Murray

R. David Murray added the comment:

Here is a proposed comment wording.

--
keywords: +patch
Added file: http://bugs.python.org/file33181/csv_dictread_setter_comment.patch

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread R. David Murray

R. David Murray added the comment:

Since it isn't easy to figure out that setting fieldnames to None would do 
anything useful without looking at the code, I'd say a code comment would be 
appropriate.  The exception would be someone backporting code from python3, but 
I think we'll just quietly ignore that possibility ;)

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
type: enhancement - behavior
versions: +Python 2.7 -Python 3.5

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



[issue18283] shutil.which() should support bytes

2013-12-17 Thread Arfrever Frehtes Taifersar Arahesis

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


--
stage: committed/rejected - 

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread Peter Otten

Peter Otten added the comment:

The proposed patch looks fine to me.

And for the record, I don't think setting fieldnames should be promoted in the 
3.x documentation. Along the lines of Eric's suggestion I should have written 
something like

 import csv
 with open(tmp.csv) as f:
... for i in range(2):
... print next(csv.DictReader(f))
... 
{'alpha': '1', 'beta': '2'}
{'epsilon': '5', 'gamma': '3', 'delta': '4'}

which would have spared you the hustle ;)

Thank you for your effort!

--

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



[issue20004] csv.DictReader classic class has a property with setter

2013-12-17 Thread R. David Murray

R. David Murray added the comment:

Committed.  Thanks, Peter.

--
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed

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



[issue992389] attribute error due to circular import

2013-12-17 Thread PJ Eby

PJ Eby added the comment:

The new patch will have weird results in the case of a parent module that 
defines an attribute that's later replaced by an import, e.g. if 
foo/__init__.py defines a variable 'bar' that's a proxy for the foo.bar module. 
 This is especially problematic if this proxy is used during the process of 
importing foo.bar

At the very least, this code should NOT be deleting the original foo.bar 
attribute, but rather restoring its previous value.

All in all, I don't think this is a productive route to take.  It was discussed 
on Python-dev previously and IIRC I outlined all the other reasons why back 
then.  The approach in issue17636 is the only one that doesn't change the 
semantics of any existing, not-currently-broken code.

In contrast, the proposed change here introduces new side-effects and *more* 
volatile state and temporal coupling.  I don't think this should go in, since 
the other approach *only* affects execution paths that would currently raise 
ImportError.

--
nosy: +pje

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2013-12-17 Thread PJ Eby

PJ Eby added the comment:

Unfortunately, this is not quite true: the weird edge cases for that approach 
are simply *different*, and harder to diagnose.  ;-)

The approach here can only affect execution paths that would currently raise 
ImportError; that one can break execution paths that are *currently working*.

As Brett said above, By declaring what the semantics will be to make the case 
even possible we are not breaking anything but making something possible.  
That is not the case for the approach proposed in the other issue.

--

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Serhiy Storchaka

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


--
versions:  -Python 3.5

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka

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



[issue19998] Python 2.7.6 fails to build _ctypes on GCC 2.x toolchain

2013-12-17 Thread Jim Carroll

Jim Carroll added the comment:

As requested, I've opened the issue with the libffi project:

https://github.com/atgreen/libffi/issues/63

--

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



[issue4492] httplib code thinks it closes connection, but does not

2013-12-17 Thread Serhiy Storchaka

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


--
stage: needs patch - test needed

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



[issue7464] circular reference in HTTPResponse by urllib2

2013-12-17 Thread Serhiy Storchaka

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


--
stage: needs patch - test needed
versions:  -Python 3.1, Python 3.2

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



[issue19946] Handle a non-importable __main__ in multiprocessing

2013-12-17 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Thanks for your hard work Nick!

--

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



[issue12441] _GLOBAL_DEFAULT_TIMEOUT remains as an object() in HTTPConnection and the connection hangs

2013-12-17 Thread Serhiy Storchaka

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


--
stage:  - test needed

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



[issue16404] Uses of PyLong_FromLong that don't check for errors

2013-12-17 Thread Serhiy Storchaka

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


--
status: open - closed

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



[issue20008] Clean up/refactor/make discoverable test_decimal

2013-12-17 Thread Zachary Ware

New submission from Zachary Ware:

This patch makes extensive changes to test_decimal, with the ultimate goal of 
making `python -m unittest discover Lib/test/ test_*.py` not choke on 
test_decimal (see issue16748).  Trying to do so uncovered a few other issues, 
such as some tests not properly cleaning up the context.

Here's a (non-exhaustive) list of what the patch will do:

- Clean up imports, including a repeated import of warnings
- Create a new hierarchy of TestCase subclasses
- BaseTestCase is an empty subclass of unittest.TestCase to serve
  as a base class for all tests that are meant to test both
  implementations.  This makes it easy to find such tests and
  create the implementation-specific test cases programmatically.
- DecimalTest defines some methods for all tests:
- setUp and tearDown, which ensure that the context is set up
  properly and cleaned up properly.  A test that changes the
  context is marked as a failure in tearDown.  These take the
  place of the toplevel init(module) function.
- assertSignals, formerly toplevel assert_signals.  It has
  also been enhanced to provide the current context if no
  context is given, and to accept strings as signals (which
  are then looked up on the current decimal module to get the
  real exception)
- assertAndClearFlags, which is a shortcut for
  assertSignals('flags' ...) and clears the flags when done.
  Several tests made no changes to the context except for
  flags, and this was a quick, easy, and convenient way to
  confirm behavior and clean up.
- CDecimalTest and PyDecimalTest, subclasses of DecimalTest which
  can be inherited from directly by tests that are meant for a
  single implementation (such as C/PyWhitebox, C/PyFunctionality),
  and are inherited by the generated subclasses of the base classes
  (IBMTestCases, FormatTest, etc.)
- Do away with the 'skip_expected' global, use a decorator to skip
  IBMTestCases if the test data can't be found.
- Clean up other toplevel setup code a bit.
- Make vertical spacing more consistent throughout the module.
- Move a couple of tests into `with localcontext()` blocks to avoid
  context pollution.
- Decorate all of CFunctionality with @requires_extra_functionality
  instead of each individual test
- Remove the explicit listing of test classes.
- Remove test_main().
- Add a Doctests base class which runs the doctests via 
  doctest.testmod() and expects a certain number of tests to have been
  run.  Attempts to use doctest.DocTestSuite were stymied by the
  two-headed nature of decimal and _decimal, and would have required a 
  load_tests function to load them anyway.
- Add tearDownModule, which restores the original contexts and checks
  to make sure sys.modules['decimal'] is as expected.
- Convert `if __name__ == '__main__'` argument handling from optparse 
  to argparse.
- Allow arguments to be passed through to unittest.main().
- The old method of specifying IBM test case names now requires a
  '--test' or '-t' switch before each set of names (more than one
  -t switch can be present, but each must have at least one name
  following).
- Add an '--extended'/'-e' switch for switching
  'EXTENDEDERRORTEST', which formerly required editing the file.
- Use unittest.main() for running the script directly.

With the patch test_decimal can be run successfully: directly, by regrtest, or 
by unittest discovery in Lib/test/; with any acceptable combination of 
arguments when run directly; with or without _decimal; with or without -OO.  I 
have not yet been able to test -DEXTRA_FUNCTIONALITY, --without-docstrings, or 
on any platform but Windows, but I don't expect any issues (of course :).

The patch is against default; 3.3 requires the removal of a usage of subTest 
and a tweaking of the Doctest expected results.

Any review will be very much appreciated!

Thanks,

Zach

--
components: Tests
files: test_decimal_cleanup.diff
keywords: needs review, patch
messages: 206482
nosy: ezio.melotti, facundobatista, mark.dickinson, rhettinger, skrah, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Clean up/refactor/make discoverable test_decimal
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33182/test_decimal_cleanup.diff

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



[issue16748] Make CPython test package discoverable

2013-12-17 Thread Zachary Ware

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


--
dependencies: +Clean up/refactor/make discoverable test_decimal, Fix test 
discovery for test_codecmaps*.py, Fix test discovery for 
test_concurrent_futures.py, Support ./python -m unittest in test_socket

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



[issue17781] optimize compilation options

2013-12-17 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy: +skrah

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



[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I can't reproduce issue. Python just hangs on read() when socat is used as test 
server. Perhaps I do something wrong.

--
nosy: +orsenthil, serhiy.storchaka
stage:  - patch review
versions: +Python 3.4 -Python 3.2

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ebace0a5a33e by Serhiy Storchaka in branch '2.7':
Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
http://hg.python.org/cpython/rev/ebace0a5a33e

New changeset 47ae858cd661 by Serhiy Storchaka in branch '3.3':
Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
http://hg.python.org/cpython/rev/47ae858cd661

New changeset d032245a122c by Serhiy Storchaka in branch 'default':
Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
http://hg.python.org/cpython/rev/d032245a122c

--
nosy: +python-dev

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



[issue20009] Property should expose wrapped function.

2013-12-17 Thread steven Michalske

New submission from steven Michalske:

When using the @property decorator the wrapped functions are not exposed for 
source introspection. (At least I can't see how they are.)

The issue is then that Ipython %psource will show the source for the 
@property as opposed to the function that it wraps.

By implementing the __wrapped__ attribute you can set the wrapped function to 
fget and then the source for that function can me identified for source 
introspection.

I perform this hack in code to overcome this issue.

class qproperty(property):
# Fix for ipython ? and ?? (%pdef, %psource)
# Omitting the class doc string prevents ipython from showing the
# doctoring for the property builtin class; I suspect this is a
# bug.
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
super(qproperty, self).__init__(fget, fset, fdel, doc)
self.__wrapped__ = fget

# Overwrite property with qproperty so that in the future this hack might
# be easily removed.
property = qproperty

This is related to issue #5982.

--
messages: 206483
nosy: hardkrash
priority: normal
severity: normal
status: open
title: Property should expose wrapped function.
type: enhancement
versions: Python 3.4, Python 3.5

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



[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

2.7 is affected too.

Thank you Simon Sapin for your contribution.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions: +Python 2.7

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



[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp

2013-12-17 Thread Civa Lin

New submission from Civa Lin:

On windows xp (Taiwanese) platform...

c:\ py -c import time; print(time.strftime('%z', time.localtime()))

It will raise a UnicodeEncodeError in my system.

I think it's not a +HHMM format and has different behavior with document:
http://docs.python.org/3/library/time.html#time.strftime

--
components: Library (Lib), Unicode, Windows
messages: 206484
nosy: civalin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: time.strftime('%z') didn't make +HHMM return in windows xp
type: behavior
versions: Python 3.3

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 226c37c209fc by Antoine Pitrou in branch '2.7':
Issue #20006: Fix sporadic failures in test_weakset.
http://hg.python.org/cpython/rev/226c37c209fc

--
nosy: +python-dev

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a3d86f80c899 by Antoine Pitrou in branch '3.3':
Issue #20006: Fix sporadic failures in test_weakset.
http://hg.python.org/cpython/rev/a3d86f80c899

New changeset 26d92a21f6cf by Antoine Pitrou in branch 'default':
Issue #20006: Fix sporadic failures in test_weakset.
http://hg.python.org/cpython/rev/26d92a21f6cf

--

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



[issue20006] Sporadic failures of test_weakset

2013-12-17 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This was all my fault :) Thanks for reporting!

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

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



[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp

2013-12-17 Thread R. David Murray

R. David Murray added the comment:

As the documentation of the module says, we pass this call through to the 
underlying c library.  What does the Windows documentation say about %z?

A quick google turns up this hit, which seems to indicate it is a platform 
problem:

http://connect.microsoft.com/VisualStudio/feedback/details/797109/strftime-incorrect-multibyte-encoding-of-timezone-z

--
nosy: +r.david.murray

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



[issue20010] time.strftime('%z') didn't make +HHMM return in windows xp

2013-12-17 Thread Civa Lin

Civa Lin added the comment:

Oh! Thanks your info!

--

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



[issue20011] Changing the signature for Parameter's constructor

2013-12-17 Thread Antony Lee

New submission from Antony Lee:

As suggested on python-ideas, this small patch changes the constructor of 
inspect.Parameter so that kind defaults to POSITIONAL_OR_KEYWORD, which 
should make code that needs to construct Parameter objects slightly less 
verbose (as I believe POSITIONAL_OR_KEYWORD is likely the most common kind).

--
components: Library (Lib)
files: parameter-constructor.patch
keywords: patch
messages: 206490
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: Changing the signature for Parameter's constructor
versions: Python 3.5
Added file: http://bugs.python.org/file33183/parameter-constructor.patch

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



[issue19524] ResourceWarning when urlopen() forgets the HTTPConnection object

2013-12-17 Thread Martin Panter

Martin Panter added the comment:

Thanks for looking at this. Perhaps you weren’t pasting the HTTP response into 
“socat”. After the six request lines are printed out, I enter the five lines 
between HTTP response start and HTTP response end; I didn’t really make 
this obvious. Otherwise, urlopen() hangs waiting for the response and read() 
never even gets called.

Here’s a Python-only HTTP server to demonstrate without needing “socat”. Run 
this in one terminal:

from http.server import HTTPServer, BaseHTTPRequestHandler
class Handler(BaseHTTPRequestHandler):
protocol_version = HTTP/1.1
def do_GET(self):
self.send_response(200)
self.send_header(Transfer-Encoding, chunked)
self.end_headers()
self.wfile.write(b0\r\n\r\n)
HTTPServer((, 8000), Handler).serve_forever()

. . . and in another terminal:

from urllib.request import urlopen
with urlopen(http://localhost:8000;) as response:
response.read()
import gc; gc.collect()

--

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



[issue19855] uuid._find_mac fails if an executable not in /sbin or /usr/sbin

2013-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b0fbaed45956 by R David Murray in branch '3.3':
#19855: uuid.get_node now looks on the PATH for executables on unix.
http://hg.python.org/cpython/rev/b0fbaed45956

New changeset 2e856fcb9084 by R David Murray in branch 'default':
Merge: #19855: uuid.get_node now looks on the PATH for executables on unix.
http://hg.python.org/cpython/rev/2e856fcb9084

New changeset 9f9ae5f7c4ae by R David Murray in branch '2.7':
#19855: uuid.get_node now looks on the PATH for executables on unix.
http://hg.python.org/cpython/rev/9f9ae5f7c4ae

--
nosy: +python-dev

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



  1   2   >