[issue1492704] distinct error type if shutil.copyfile() fails because of src and dst are the same file

2012-10-29 Thread Hynek Schlawack

Hynek Schlawack added the comment:

You're welcome. :)

--

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



[issue16353] add function to os module for getting path to default shell

2012-10-29 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


--
nosy: +asvetlov

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



[issue8604] Adding an atomic FS write API

2012-10-29 Thread Nick Coghlan

Nick Coghlan added the comment:

Since it may not be clear from the rest of the thread, the os.replace() 
cross-platform atomic renaming building block was added in 3.3 (in #8828, which 
Victor linked above)

Another stdlib use case now also exists in importlib (see 
http://hg.python.org/cpython/file/3.3/Lib/importlib/_bootstrap.py#l121). 
However, due to bootstrapping issues, importlib would not be able to use a 
version that was provided in a module like shutil.

--
nosy: +ncoghlan
versions: +Python 3.4 -Python 3.2

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



[issue16290] PyComplex_AsCComplex should allow __complex__ to return float.

2012-10-29 Thread Mark Dickinson

Mark Dickinson added the comment:

Jesús:  see the first message.

--

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



[issue15650] PEP 3121, 384 refactoring applied to dbm module

2012-10-29 Thread Andrew Svetlov

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


Added file: http://bugs.python.org/file27774/Issue15650_v2.diff

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



[issue16354] Remember python version choice on docs.python.org

2012-10-29 Thread Wichert Akkerman

New submission from Wichert Akkerman:

docs.python.org was recently change to redirect http://docs.python.org/ to 
http://docs.python.org/3/ , with an option to switch to documentation for a 
different version using both (why two ways?) a dropdown and links in the left 
column. Would it be possible to remember the selection and honour that in the 
docs.python.org redirect? That would remove the minor annoyance of always 
ending up at the Python 3 documentation and having to switch back to 2.7.

--
assignee: docs@python
components: Documentation
messages: 174106
nosy: docs@python, wichert
priority: normal
severity: normal
status: open
title: Remember python version choice on docs.python.org

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



[issue16312] New command line option supported by unittest.main() for running initialization code before tests

2012-10-29 Thread Michael Foord

Michael Foord added the comment:

Is this logging specific issue an actual problem or a theoretical problem? It's 
not a problem I've ever seen (myself), nor the one the issue was opened for.

--

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu

New submission from Marco Buttu:

The documentation for `inspect.getcomments()` says that it returns 
the lines of comments immediately preceding an object's source code.
It works fine for the comments that immediately preceded an object 
defined in a module:

$ more foo.py 
import inspect
# A dummy comment
def foo():
pass

print(inspect.getcomments(foo))
$ python3.3 foo.py 
# A dummy comment

But it does not work if we define an object interactively:

$ python3.3
Python 3.3.0 (default, Oct  9 2012, 18:20:32) 
[GCC 4.5.2] on linux
Type help, copyright, credits or license for more information.
 import inspect
 # A dummy comment
... def foo():
... pass
... 
 inspect.getcomments(foo)
 # A dummy comment
... 
 def foo():
... pass
... 
 inspect.getcomments(foo)


--
components: Library (Lib)
messages: 174108
nosy: marco.buttu
priority: normal
severity: normal
status: open
title: inspect.getcomments() does not work in the interactive shell
type: behavior
versions: Python 3.3

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



[issue16350] zlib.Decompress.decompress() after EOF discards existing value of unused_data

2012-10-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

From Nadeem Vawda's mail:

 I wasn't suggesting that you try to resize the existing unused_data
 object; I agree that this would be a bad idea. What I was thinking of
 was something like this:
 
 size_t old_unused_size = PyBytes_GET_SIZE(self-unused_data);
 size_t new_unused_size = old_unused_size + self-zst.avail_in;
 PyObject *new_unused_data = PyBytes_FromStringAndSize(NULL, 0);
 if (_PyBytes_Resize(new_unused_data, new_unused_size)  0) {
 Py_DECREF(RetVal);
 goto error;
 }
 memcpy(PyBytes_AS_STRING(new_unused_data),
PyBytes_AS_STRING(self-unused_data),
old_unused_size);
 memcpy(PyBytes_AS_STRING(new_unused_data) + old_unused_size,
self-zst.next_in, self-zst.avail_in);
 Py_DECREF(self-unused_data);
 self-unused_data = new_unused_data;
 
 Basically, hacking around the fact that (AFAICT) there's no direct way to
 allocate an uninitialized bytes object. That way we only do one allocation,
 and only copy the new data once.

This hacking is not needed, if first argument of PyBytes_FromStringAndSize() is 
NULL, the contents of the bytes object are uninitialized. And more, this 
hacking is invalid, because empty bytes object shared and can't be resized.

Patch updated. The concatenation optimized as you suggested, one bug fixed.

--
Added file: http://bugs.python.org/file27775/zlib_accum_unused_data_2.patch

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



[issue16312] New command line option supported by unittest.main() for running initialization code before tests

2012-10-29 Thread Vinay Sajip

Vinay Sajip added the comment:

Not an actual problem (for me), and although the issue was opened for more 
general functionality, logging is the only specific use case that was actually 
cited.

--

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray

R. David Murray added the comment:

That's because inspecting source code requires that there be a source file to 
inspect.

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

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray

R. David Murray added the comment:

Hmm.  Reopening in case someone wants to see if we can generate an appropriate 
error message when there is no source file to inspect.

--
status: closed - open
versions: +Python 2.7, Python 3.4

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu

Marco Buttu added the comment:

If inspect.getcomments() requires a source file to inspect, I think it would be 
better to indicate it in the doc.

--

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



[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue16356] cjson dose not decode \/ properly

2012-10-29 Thread Richard Delorenzi

New submission from Richard Delorenzi:

This code produces the wrong result

import cjson
cjson.decode(cjson.encode('/'))

It produces '\\/', it should produce '/'

using
/usr/lib/pymodules/python2.7/cjson.so
cjson version 1.0.5-4build1

--
components: None
messages: 174114
nosy: Richard.Delorenzi
priority: normal
severity: normal
status: open
title: cjson dose not decode \/ properly
type: behavior
versions: Python 2.7

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



[issue16356] cjson dose not decode \/ properly

2012-10-29 Thread Christian Heimes

Christian Heimes added the comment:

cjson is a third party module and not part of Python's standard library. Please 
report the error to the author of the cjson package. 

Python 2.7 has a builtin json encoder and decoder. The package is called 
'json'. http://docs.python.org/2.7/library/json.html#module-json

--
nosy: +christian.heimes
resolution:  - invalid
status: open - closed
versions: +3rd party -Python 2.7

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



[issue16344] Traceback Internationalization Proposal

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

 serious developers? sorry but I think that is a unfortunate phrase
 that goes against the Python Diversity Statement

With serious I just mean anyone that wants to continue programming, as 
opposed as someone doing e.g. a one-off course at university (hence the 
quotes).  The whole ecosystem around Python and most of the other programming 
languages is mostly in English, and anyone that doesn't know English will have 
to face many other problems later on (e.g. no localized documentation and blog 
posts).

There are two solutions to this problem:
1) adapt the language to the users;
2) teach the users English;

While the first (i.e. what you are proposing) works as a short term solution, I 
believe the second is a much better long term solution, because IMHO users will 
anyway have to learn English sooner or later.


 In some places (like my country, public schools), English is not
 teach formally until the University.

This is very unfortunate -- I was under the impression that teaching English in 
middle/high schools was already common in most of the countries.

 And I don't think non-English speakers are just a subset of users.

Do you mean people that aren't native English speakers or people who don't even 
grasp enough English to understand the error messages?

 BTW, as the draft says, Python is the offender here, as other error
 messages are already translated (including the OS ones, even inside
 Python!):

This is another thing that I dislike, for the aforementioned reasons.  I've 
seen buildbots reporting unintelligible error messages in German, and just a 
few days ago I even came across a mercurial version in Russian.
It makes somewhat sense to translate OS error messages, because they are read 
by regular users that have a localized OS and expect localized messages.  The 
same could be said for bash, even if the distinction between regular users 
and developers starts to fade a bit here.


 I don't see why this could cause confusion, instead that, I think
 python would become more consistent with other tools and thus more 
 easy to use.

For example the other day I saw a student confused by this error message:
 a, b = 1, 2, 3
ValueError: too many values to unpack (expected 2)

The offender here is most likely the word unpack.  Unpack is closely 
related to the concept of tuple unpacking, so if the student is aware of what 
tuple unpacking is, he might fail to associate the problem with it if the error 
uses another word.  In addition, I can not think of any word that might be a 
suitable translation for unpack in my native language.  In Spanish 
desempaquetar could maybe be used, but I'm not sure how well it works.



 The mechanism to restore the language is the common one (used by 
 almost every other application that support i18n):
  locale.setlocale(locale.LC_MESSAGES, C)
 It should be not difficult for serious programmers to handle that :-)
 If that is a concern, it could be implemented a command line 
 parameter, a environment variable or a shortcut in locale module.

It's not difficult to change, but you would have to remember how to do it and 
what LC_* variable you should change.  Assuming this gets implemented it would 
most likely require a command line parameter and an envvar too.

 Anyway, people will not necessarily be faced by default with the 
 localized version, an if for example, a teacher has to jump to an 
 student machine, surely it could use it as messages will be probably 
 in the spoken language of the country (BTW, probably most of the 
 operating system components will be localized, not only Python)

FWIW I've been in the situation where neither my students nor I could 
understand the local language -- luckily all the machines were using English.

 If PostgreSQL and other tools could do that, why Python could not?

Does any other popular programming language do it?  And if so, how?

--

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



[issue16356] cjson dose not decode \/ properly

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

This works fine with the standard json module.
 json.loads(json.dumps('/'))
'/'

FWIW 'json' also has C accelerations.

--
nosy: +ezio.melotti
stage:  - committed/rejected

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



[issue15869] IDLE: Include .desktop file and icon

2012-10-29 Thread Dale E. Moore

Dale E. Moore added the comment:

On Ubuntu 12.10 with Unity the task icon is a question mark. And when locked to 
launcher the button does not start idle.

--
nosy: +DaleEMoore

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray

R. David Murray added the comment:

Yeah, this should be a doc bug.  After I thought about it some more I realized 
that changing the behavior to raise an error would not be a good idea.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti

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


--
keywords: +easy
nosy: +ezio.melotti
stage: committed/rejected - needs patch
type: behavior - enhancement
versions: +Python 3.2

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Marco Buttu

Marco Buttu added the comment:

I saw there is the same lack of clarity in the doc of `inspect.getsource()`:

 import inspect
 print(inspect.getsource.__doc__)
Return the text of the source code for an object.

The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a single string.  An
IOError is raised if the source code cannot be retrieved.
 def foo():
... pass
... 
 inspect.getsource(foo)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/local/lib/python3.3/inspect.py, line 726, in getsource
lines, lnum = getsourcelines(object)
  File /usr/local/lib/python3.3/inspect.py, line 715, in getsourcelines
lines, lnum = findsource(object)
  File /usr/local/lib/python3.3/inspect.py, line 563, in findsource
raise IOError('could not get source code')
OSError: could not get source code

--

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



[issue16357] SSLSocket created from SSLContext.wrap_socket doesn't include cert/keyfile

2012-10-29 Thread Jeff McNeil

New submission from Jeff McNeil:

mcjeff@martian:~/cpython$ ./python -V
Python 3.4.0a0

When an SSLSocket is created via SSLContext.wrap_socket, it is passed a 
_context parameter directly.  SSLSocket.__init__ sets self.context at this 
point, but it does not set self.keyfile or self.certfile.

However, in SSLSocket.accept, both keyfile  certfile are passed when creating 
a new, wrapped SSLSocket, from socket.accept's newsock.

The result is an attribute error.
 import ssl
 c = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
 c.load_cert_chain('Lib/test/keycert.pem')
 import socket
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
 s.bind(('127.0.0.1', 5050))
 s.listen(5)
 s.accept()  # nc localhost 5050 in another term.
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/local/google/home/mcjeff/cpython/Lib/ssl.py, line 557, in accept
keyfile=self.keyfile, certfile=self.certfile,
AttributeError: 'SSLSocket' object has no attribute 'keyfile'
 

Attached one-liner addresses it by passing in the context rather than the 
keyfile  certfile.

 s.accept()
(socket.socket object, fd=4, family=2, type=1, proto=0, ('127.0.0.1', 37306))


--
components: Library (Lib)
files: ssl_context.patch
keywords: patch
messages: 174121
nosy: mcjeff
priority: normal
severity: normal
status: open
title: SSLSocket created from SSLContext.wrap_socket doesn't include 
cert/keyfile
versions: Python 3.4
Added file: http://bugs.python.org/file27776/ssl_context.patch

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

 After I thought about it some more I realized that changing
 the behavior to raise an error would not be a good idea.

Can you elaborate more?
Failing silently doesn't seem much better than raising an error, especially if 
similar functions already raise.

--
components: +Library (Lib)
resolution: invalid - 
type: enhancement - behavior

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



[issue16358] Enhancement for mmap_read: Consistency with standard file read

2012-10-29 Thread Elwyn Davies

New submission from Elwyn Davies:

Enhancement requested for module mmap:
Alter the interface of mmap.read from
mmap.read(num)
to
mmap.read([num])
reading the whole file if no argument provided.

The read function in the mmap module (Modules/mmapmodule.c) *requires* an 
argument whereas for the standard file read function the argument is optional 
and the function reads the remainder of the file if absent.

The mmap module knows how big the file is, so it should be no problem to 
internally use the remaining length if no argument is supplied.  

This would avoid having to write (for example)
f = mmap.mmap(file_desc, file_size)
b = f.read(file_size)
j = json.loads(b)

instead of
f = mmap.mmap(file_desc, file_size)
j = json.load(f)

--
components: Library (Lib)
messages: 174123
nosy: elwynd
priority: normal
severity: normal
status: open
title: Enhancement for mmap_read: Consistency with standard file read
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

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



[issue16338] pysnmp/asyncore - timeout ineffective?

2012-10-29 Thread Trenton Craig

Trenton Craig added the comment:

So, in testing, we reset retries to 1 instead of 0, and on our ubuntu 
environment this allows it to function.  So issue is not with timeout, but with 
the retries variable.

--

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray

R. David Murray added the comment:

If similar functions already raise, then changing it for 3.4 would be OK.  But 
to change it for earlier versions would risk breaking working programs.

--

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



[issue8401] Strange behavior of bytearray slice assignment

2012-10-29 Thread Ezio Melotti

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


Added file: http://bugs.python.org/file2/issue8401-2.diff

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



[issue16359] can't print figures 08 and 09

2012-10-29 Thread jose gregorio fernandez trincado

New submission from jose gregorio fernandez trincado:

In [2]: 09
  File ipython-input-2-7010843e6b42, line 1
09
 ^
SyntaxError: invalid token

Using str() produce SyntaxError too. The same for 08. Figures like 01 and 02 
produce the appropriate output.

Hardware: Lenovo 3000 N200, 80Gb of HD, 4Gb of RAM, Core-Duo 2.6GHz
OS: Ubuntu 12.04, 64bits.

--
components: None
messages: 174126
nosy: jose.gregorio.fernandez.trincado
priority: normal
severity: normal
status: open
title: can't print figures 08 and 09
type: behavior
versions: Python 2.7

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



[issue16358] Enhancement for mmap_read: Consistency with standard file read

2012-10-29 Thread R. David Murray

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


--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - mmap.read requires an argument

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



[issue16359] can't print figures 08 and 09

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

Those are invalid octal literals, since the digits 8 and 9 don't exist in octal.
See 
http://docs.python.org/2/reference/lexical_analysis.html#grammar-token-octinteger

--
nosy: +ezio.melotti
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue10782] Not possible to cross-compile due to poor detection of %lld support in printf

2012-10-29 Thread Ben Gamari

Changes by Ben Gamari bgam...@gmail.com:


--
status: open - languishing

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



[issue16348] Decimal.remainder_near documentation incorrect.

2012-10-29 Thread Andrew Svetlov

Andrew Svetlov added the comment:

LGTM

--
nosy: +asvetlov

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



[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I wonder what the semantics should be. I would like to just clear the 
dictionary that is returned from __new__ but you're also allowed to return 
custom classes from __new__ which we might not know how to clear.

--

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



[issue16360] argparse: comma in metavar causes assertion failure when formatting long usage message

2012-10-29 Thread Ben Gamari

New submission from Ben Gamari:

argparse suffers from a failing assertion when formatting a long usage message 
with an option whose metavar contains a comma. This can be seen in the attached 
testcase, which fails with,

Traceback (most recent call last):
  File /home/ben/hi.py, line 24, in module
args = parser.parse_args()
  File /usr/lib/python2.7/argparse.py, line 1688, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File /usr/lib/python2.7/argparse.py, line 1720, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File /usr/lib/python2.7/argparse.py, line 1937, in _parse_known_args
self.error(_('too few arguments'))
  File /usr/lib/python2.7/argparse.py, line 2360, in error
self.print_usage(_sys.stderr)
  File /usr/lib/python2.7/argparse.py, line 2322, in print_usage
self._print_message(self.format_usage(), file)
  File /usr/lib/python2.7/argparse.py, line 2278, in format_usage
return formatter.format_help()
  File /usr/lib/python2.7/argparse.py, line 279, in format_help
help = self._root_section.format_help()
  File /usr/lib/python2.7/argparse.py, line 209, in format_help
func(*args)
  File /usr/lib/python2.7/argparse.py, line 330, in _format_usage
assert ' '.join(opt_parts) == opt_usage
AssertionError

This failure is apparently due to a regular expression used to wrap  the usage 
message. The solution to this is unclear, but it seems to me using a regular 
expression here is a hack at best.

--
components: Library (Lib)
files: hi.py
messages: 174130
nosy: bgamari
priority: normal
severity: normal
status: open
title: argparse: comma in metavar causes assertion failure when formatting long 
usage message
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file27778/hi.py

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



[issue16350] zlib.Decompress.decompress() after EOF discards existing value of unused_data

2012-10-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is yet one memory management bug (with unconsumed_tail).

flush() does not update unconsumed_tail and unused_data.

 import zlib
 x = zlib.compress(b'abcdefghijklmnopqrstuvwxyz') + b'0123456789'
 dco = zlib.decompressobj()
 dco.decompress(x, 1)
b'a'
 dco.flush()
b'bcdefghijklmnopqrstuvwxyz'
 dco.unconsumed_tail
b'NIMK\xcf\xc8\xcc\xca\xce\xc9\xcd\xcb/(,*.)-+\xaf\xa8\xac\x02\x00\x90\x86\x0b 
0123456789'
 dco.unused_data
b''

What should unconsumed_tail be equal after EOF? b'' or unused_data?

 import zlib
 x = zlib.compress(b'abcdefghijklmnopqrstuvwxyz') + b'0123456789'
 dco = zlib.decompressobj()
 dco.decompress(x)
b'abcdefghijklmnopqrstuvwxyz'
 dco.flush()
b''
 dco.unconsumed_tail
b''
 dco.unused_data
b'0123456789'
 dco = zlib.decompressobj()
 dco.decompress(x, 1000)
b'abcdefghijklmnopqrstuvwxyz'
 dco.flush()
b''
 dco.unconsumed_tail
b'0123456789'
 dco.unused_data
b'0123456789'

--

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



[issue8401] Strange behavior of bytearray slice assignment

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

The new patch further improve tests and error message, checking for both 
numbers and strings:

 b = bytearray(b'fooo')
 b[3:4] = 'foo'
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
 b[3:4] = 5
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
 b[3:4] = 5.2
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)
 b[3:4] = None
TypeError: 'NoneType' object is not iterable


Before the patch these errors were reported instead:

 b = bytearray(b'fooo')
 b[3:4] = 'foo'  # can't provide encoding here
TypeError: string argument without an encoding
 b[3:4] = 5  # this worked
 b[3:4] = 5.2
TypeError: 'float' object is not iterable
 b[3:4] = None
TypeError: 'NoneType' object is not iterable

--
Added file: http://bugs.python.org/file27779/issue8401-3.diff

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread Ezio Melotti

Ezio Melotti added the comment:

Not sure if they can be considered working programs if the function fails 
silently.  Do you have some specific example in mind?

--

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



[issue16355] inspect.getcomments() does not work in the interactive shell

2012-10-29 Thread R. David Murray

R. David Murray added the comment:

Not a specific package, but a specific use case (assuming getcomments is in use 
at all :)

Consider a program that uses getcomments to look for a pragma-like comment 
before a function, but one that is not critical to the program's function 
(perhaps it has to do with testing or tracing infrastructure...).  If the 
source file does not exist, then that is equivalent to their being no pragma.  
So the program would work fine even if the source is deleted...until this 
getcomments starts to raise an error, when it promptly crashes (probably in a 
production system, since that is the most likely place for source to be 
absent...)

--

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



[issue16262] srcdir != builddir builds fail, if hg is not installed

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c6787a4c544e by Ross Lagerwall in branch '3.2':
Fix regression from issue #16262
http://hg.python.org/cpython/rev/c6787a4c544e

New changeset b82a4f8a4c67 by Ross Lagerwall in branch '3.3':
Merge with 3.2 for issue #16262
http://hg.python.org/cpython/rev/b82a4f8a4c67

New changeset 1bee1a176306 by Ross Lagerwall in branch 'default':
Merge with 3.3 for issue #16262
http://hg.python.org/cpython/rev/1bee1a176306

--

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



[issue16354] Remember python version choice on docs.python.org

2012-10-29 Thread Georg Brandl

Georg Brandl added the comment:

If you always want to end up on Python 2 docs, why don't you go to 
docs.python.org/2 in the first place?

--
nosy: +georg.brandl

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



[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius

Mark Gius added the comment:

Patch fixes and tests fd leak on Python 3.3.  Test fails without fix, passes 
with fix.

I found an existing test looking for fd leaks for another bug.  Borrowed the 
verification bits from it.

There were some other test failures when I ran the subprocess suite on my 
laptop, but it more like I had some environmental issue rather than having 
genuinely broken anything.  If somebody else (or the test bots?) could run the 
tests I would appreciate it.

--
Added file: http://bugs.python.org/file27780/fix_16327_on_3.3.diff

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



[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius

Mark Gius added the comment:

Here's more or less the same fix and test on 2.7.  I jumped through the hoop to 
preserve the original exception and traceback even if os.close() raises an 
exception.

This follows the 3.3 branch's cleanup behavior of silently suppressing errors 
in the cleanup code.

--
Added file: http://bugs.python.org/file27781/fix_16327_on_2.7.diff

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



[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius

Mark Gius added the comment:

I've also submitted the contributor form requested.

--

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



[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Armin Rigo

Armin Rigo added the comment:

In case of doubt, see the source code of PyPy :-)

w_dict = space.call_function(w_type)
for w_key in space.listview(w_keys):
space.setitem(w_dict, w_key, w_fill)

(Seriously more compact.)  No clear there...

--

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



[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Armin Rigo

Armin Rigo added the comment:

Joke apart, you could check and complain if the object returned is an instance 
of 'dict' and is not empty.  Otherwise just accept it.  I think complaining is 
better than picking either of the two behaviors in this case.

--

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



[issue16262] srcdir != builddir builds fail, if hg is not installed

2012-10-29 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
assignee:  - rosslagerwall
nosy: +rosslagerwall
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 3.2, Python 3.4

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



[issue14897] struct.pack raises unexpected error message

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 626ed0e06fd6 by Petri Lehtinen in branch '2.7':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/626ed0e06fd6

New changeset a555bd4026b0 by Petri Lehtinen in branch '3.2':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/a555bd4026b0

New changeset 70d5906e0461 by Petri Lehtinen in branch '3.3':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/70d5906e0461

New changeset ebc588a3db51 by Petri Lehtinen in branch 'default':
#14897: Enhance error messages of struct.pack and struct.pack_into
http://hg.python.org/cpython/rev/ebc588a3db51

--
nosy: +python-dev

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



[issue16336] Check input in surrogatepass error handler

2012-10-29 Thread Philip Jenvey

Philip Jenvey added the comment:

Thanks for picking this and the warning/slowdown up, Serhiy. The patch LGTM, 
for whatever that's worth =]

--

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



[issue14897] struct.pack raises unexpected error message

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Applied, thanks!

--
nosy: +petri.lehtinen
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

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



[issue15916] change doctest DocTestSuite not to raise ValueError if no docstrings

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

And that comment was meant for totally separate issue, sorry.

--

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

+for key in vars(subnamespace):
+setattr(namespace, key, getattr(subnamespace, key))

There might be even more clever ways to achieve this, but what about at least 
saying for key, value in vars(subnamespace).items(), and then using the value 
accordingly, to avoid the getattr() call?

--

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



[issue15916] change doctest DocTestSuite not to raise ValueError if no docstrings

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

+for key in vars(subnamespace):
+setattr(namespace, key, getattr(subnamespace, key))

There might be even more clever ways to achieve this, but what about at least 
saying for key, value in vars(subnamespace).items(), and then using the value 
accordingly, to avoid the getattr() call?

--
nosy: +petri.lehtinen

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



[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)

2012-10-29 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Checking whether a type is unsigned in configure.ac might be cumbersome...

--

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



[issue8913] Document that datetime.__format__ is datetime.strftime

2012-10-29 Thread Heikki Partanen

Heikki Partanen added the comment:

Thanks for the comments, Eric!

I reworded the docs and improved the examples too (being stuck in 2.6 I didn't 
even know about the cool autonumbering :)

--
Added file: http://bugs.python.org/file27782/issue8913-2.patch

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



[issue16354] Remember python version choice on docs.python.org

2012-10-29 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Or set a bookmark. :)

--
nosy: +chris.jerdonek

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



[issue16357] SSLSocket created from SSLContext.wrap_socket doesn't include cert/keyfile

2012-10-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't understand your code snippet: you don't seem to wrap the socket 
anywhere (paste error?).
As for the patch, it would be nice to add a corresponding test in 
Lib/test/test_ssl.py.

--
nosy: +pitrou
stage:  - patch review
type:  - behavior
versions: +Python 3.2, Python 3.3

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



[issue16268] dir(closure) does not find __dir__

2012-10-29 Thread Bradley Froehle

Bradley Froehle added the comment:

This rather obscure bug seems to be caused by a failure to properly initialize 
PyCell_Type.

Running with GDB, we see that _PyType_Lookup(class 'cell',  __dir__) 
fails in:

/* Look in tp_dict of types in MRO */
mro = type-tp_mro;

/* If mro is NULL, the type is either not yet initialized
   by PyType_Ready(), or already cleared by type_clear().
   Either way the safest thing to do is to return NULL. */
if (mro == NULL)
return NULL;

Since:

(gdb) print PyCell_Type-tp_mro
$9 = (PyObject *) 0x0

Searching the code base shows that we never call PyType_Ready(PyCell_Type).

A patch is attached.

--
keywords: +patch
nosy: +bfroehle
Added file: http://bugs.python.org/file27783/init_cell_type.patch

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



[issue16268] dir(closure) does not find __dir__

2012-10-29 Thread Bradley Froehle

Bradley Froehle added the comment:

Note that we fail to initialize PyCell_Type in all versions of Python, even if 
there aren't any visible ramifications in earlier versions.

--

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



[issue2005] posixmodule expects sizeof(pid_t/gid_t/uid_t) = sizeof(long)

2012-10-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Checking whether a type is unsigned in configure.ac might be cumbersome...

This can be done in compile time. Something like:

  if ((uid_t)-1  0) ...

--

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



[issue16357] SSLSocket created from SSLContext.wrap_socket doesn't include cert/keyfile

2012-10-29 Thread Jeff McNeil

Jeff McNeil added the comment:

Ak! Yes, cut and paste error.

Python 3.4.0a0 (default:57a33af85407, Oct 27 2012, 21:26:30) 
[GCC 4.4.3] on linux
Type help, copyright, credits or license for more information.
 import ssl  
 c = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
 c.load_cert_chain('Lib/test/keycert.pem')
 import socket
 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
 s.bind(('127.0.0.1', 5050))
 s = c.wrap_socket(s)
 s.listen(5)
 s.accept()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/jeff/cpython/Lib/ssl.py, line 557, in accept
keyfile=self.keyfile, certfile=self.certfile,
AttributeError: 'SSLSocket' object has no attribute 'keyfile'
 

I'll add a corresponding test, sure thing.

--

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



[issue16357] SSLSocket created from SSLContext.wrap_socket doesn't include cert/keyfile

2012-10-29 Thread Jeff McNeil

Jeff McNeil added the comment:

Updated to pass in the parent context only actually, as it doesn't look like 
all of the attributes on SSLSocket will be set if a context was initially 
passed in.

--
Added file: http://bugs.python.org/file27784/ssl_context_2.patch

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



[issue11566] hypot define in pyconfig.h clashes with g++'s cmath

2012-10-29 Thread Václav Šmilauer

Václav Šmilauer added the comment:

I would like to second Ralf here. I am having the same issue with mingw's gcc 
4.7 and -std=c++11.

--
nosy: +eudoxos

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



[issue16361] HTTPS/TLS Problem in Python 3.3

2012-10-29 Thread Phil

New submission from Phil:

I had converted some code for a scraper from 2.7.3 to 3.3.0 on Windows 7 and 
suddenly the code stopped working.  Now the https fetch results in:
Traceback (most recent call last):
  File D:\Users\Phil\Desktop\demo.py, line 67, in module
page=getWebData()
  File D:\Users\Phil\Desktop\demo.py, line 59, in getWebData
response=urllib.request.urlopen(req, cadefault=False)
  File D:\Program Files\Python33\lib\urllib\request.py, line 160, in urlopen
return opener.open(url, data, timeout)
  File D:\Program Files\Python33\lib\urllib\request.py, line 473, in open
response = self._open(req, data)
  File D:\Program Files\Python33\lib\urllib\request.py, line 491, in _open
'_open', req)
  File D:\Program Files\Python33\lib\urllib\request.py, line 451, in 
_call_chain
result = func(*args)
  File D:\Program Files\Python33\lib\urllib\request.py, line 1287, in 
https_open
context=self._context, check_hostname=self._check_hostname)
  File D:\Program Files\Python33\lib\urllib\request.py, line 1255, in do_open
raise URLError(err)
urllib.error.URLError: urlopen error [WinError 10054] An existing connection 
was forcibly closed by the remote host
 
I have run Wireshark using Python 2.7.3 and Python 3.3.0 (see attached files)

--
components: Library (Lib)
files: demo.py
messages: 174158
nosy: pventura
priority: normal
severity: normal
status: open
title: HTTPS/TLS Problem in Python 3.3
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file27785/demo.py

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



[issue16361] HTTPS/TLS Problem in Python 3.3

2012-10-29 Thread Phil

Changes by Phil pvent...@broward.edu:


Added file: http://bugs.python.org/file27786/py2-filtered.pcapng

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



[issue16361] HTTPS/TLS Problem in Python 3.3

2012-10-29 Thread Phil

Changes by Phil pvent...@broward.edu:


Added file: http://bugs.python.org/file27787/py3-filtered.pcapng

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




[issue16361] HTTPS/TLS Problem in Python 3.3

2012-10-29 Thread Phil

Phil added the comment:

You will notice that in the Python 3.3.0 version after packet 54 (Client 
Hello), there seems to be no response from the server.
Today, I was able to verify that the code worked under Python 3.2.3.

--

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



[issue16345] dict.fromkeys() assumes 'self' is empty

2012-10-29 Thread Benjamin Peterson

Benjamin Peterson added the comment:

That's still inconsistent, though, since we wouldn't complain if __new__ 
returns a user defined object.

--

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



[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

See also the issue #836035.

--

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



[issue16197] Several small errors in winreg documentation

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b9e14b89199b by Brian Curtin in branch '3.2':
Fix #16197. Update docstrings and documentation to match winreg code.
http://hg.python.org/cpython/rev/b9e14b89199b

--
nosy: +python-dev

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



[issue16197] Several small errors in winreg documentation

2012-10-29 Thread Brian Curtin

Brian Curtin added the comment:

Pushed fixes for 3.2+

Thanks for the patch!

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

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



[issue16358] Enhancement for mmap_read: Consistency with standard file read

2012-10-29 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue12021] mmap.read requires an argument

2012-10-29 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

According to CRT source code:
 - tzset() uses WideCharToMultiByte(lc_cp, 0, tzinfo.StandardName, -1, 
tzname[0], _TZ_STRINGS_SIZE - 1, NULL, defused) with lc_cp = 
___lc_codepage_func().
 - wcsftime(%z) and wcsftime(%Z) use _mbstowcs_s_l() to decode the time 
zone name

I tried to call ___lc_codepage_func(): it returns 0. I suppose that it means 
that mbstowcs() and wcstombs() use the ANSI code page.

Instead of trying to bet what is the correct encoding, it would be simpler (and 
safer) to read the Unicode version of the tzname array: StandardName and 
DaylightName of GetTimeZoneInformation().

If anything is changed, time.strftime(), time.strptime(), 
datetime.datetime.strftime() and time.tzname must be checked (with %Z format).

--

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



[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

Instead of trying to bet what is the correct encoding, it would be simpler 
(and safer) to read the Unicode version of the tzname array: StandardName and 
DaylightName of GetTimeZoneInformation().

GetTimeZoneInformation() formats correctly timezone names, but it reintroduces 
#10653 issue: time.strftime(%Z) formats the timezone name differently.

See also issue #13029 which is a duplicate of #10653, but contains useful 
information.

--

Example on Windows 7 with a french setup configured to Tokyo's timezone.

Using GetTimeZoneInformation(), time.tzname is (Tokyo, Tokyo (heure 
d\u2019\xe9t\xe9)). U+2019 is the RIGHT SINGLE QUOTATION MARK. This 
character is usually replaced with U+0027 (APOSTROPHE) in ASCII.

time.strftime(%Z) gives Tokyo (heure d'\x81\x66ete) (if it is implemented 
using strftime() or wcsftime()).

--

If I understood correctly, Python 3.3 has two issues on Windows:

 * time.tzname is decoded from the wrong encoding
 * time.strftime(%Z) gives an invalid output

The real blocker issue is a bug in strftime() and wcsftime() in Windows CRT. A 
solution is to replace %Z with the timezone name before calling strftime() or 
wcsftime(), aka working around the Windows CRT bug.

--
nosy: +ocean-city

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



[issue16310] zipfile: allow surrogates in filenames

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

 The use-case is building Python distributions containing
 non-ASCII filenames.

It's possible to distribute Python packages with non-ASCII filenames.

 So yes, I have Latin-1 bytes on the filesystem,
 even though my locale is UTF-8.

You system is not configured correctly. If you would like to distribute such 
invalid filename, how do you plan to access it on other platforms where the 
filename is decoded differently? It would be safer to build your project on a 
well configured system.

See issues mentionned in msg173766 to support: creating a ZIP archive with 
invalid filenames, and be able to specify the encoding of filenames when 
decoding a ZIP archive.

--

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



[issue16330] Use surrogate-related macros

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 13dd8199c112 by Victor Stinner in branch 'default':
Issue #16330: Use surrogate-related macros
http://hg.python.org/cpython/rev/13dd8199c112

--
nosy: +python-dev

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



[issue16330] Use surrogate-related macros

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

But not all surrogate-related code uses this macros.  I suppose this is done 
inadvertently, somewhere the macro and naked code used in neighboring lines.

Yeah, I forgot to use the new macros in these files. Thanks for your patch, I 
applied it. I also fixed *IS*() macros to add parenthesis around the argument.

--

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



[issue16335] Integer overflow in unicode-escape decoder

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

If I understood correctly, (b'\\N{' + b'x' * (INT_MAX+1)) + 
'}').decode('unicode-decode') may crash? Did you try such string?

--

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



[issue14625] Faster utf-32 decoder

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

 I suggest apply patch A to 3.3 as it fixes performance
 regression (2x) and is very simple.

ASCII and UTF-8 are the two most common codecs in the world, so it's justified 
to have heavily optimized encoders and decoders.

I don't know any application using UTF-32-LE or UTF-32-BE. So I don't want to 
waste Python memory/code size with a heavily optimized decoder. The patch A 
looks to be enough.

--

32 bit units is commonly used with wchar_t, but this format already has a fast 
decoder, PyUnicode_FromWideChar(), which uses memcpy() or 
_PyUnicode_CONVERT_BYTES().

--

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



[issue16311] Use _PyUnicodeWriter API in text decoders

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

Soon I'll post a patch, which speeds up unicode-escape and raw-unicode-escape 
decoders to 1.5-3x. Also there are not yet reviewed patches for UTF-32 
(issue14625) and charmap (issue14850) decoders. Will be merge conflicts.

codecs_writer.patch doesn't change too much the core of decoders, but mostly 
the code before and after the loop, and error handling. You can still use 
PyUnicode_WRITE, PyUnicode_READ, memcpy(), etc.

But I will review the patch.

If you review the patch, please check that how the buffer is allocated. It 
should not be overallocated by default, only on the first error. Overallocation 
can kill performances when it is not necessary (especially on Windows).

--

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



[issue15478] UnicodeDecodeError on OSError on Windows with undecodable (bytes) filename

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 67d69f943b7f by Victor Stinner in branch 'default':
Issue #15478: Raising an OSError doesn't decode or encode the filename anymore
http://hg.python.org/cpython/rev/67d69f943b7f

--
nosy: +python-dev

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



[issue12890] cgitb displays p tags when executed in text mode

2012-10-29 Thread Stephen Tonkin

Stephen Tonkin added the comment:

Uploaded a patch which fixes the failing on Windows 7.

It was essentially an issue with the Windows path returned by temp_dir() 
containing unescaped backslashes. A repr() fixed this.

--
nosy: +sptonkin
Added file: http://bugs.python.org/file27788/p12890-2.diff

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



[issue12890] cgitb displays p tags when executed in text mode

2012-10-29 Thread Aaron Iles

Aaron Iles added the comment:

Patch successfully tested on Mac OSX 10.8. No regressions.

--
nosy: +aliles

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



[issue15478] UnicodeDecodeError on OSError on Windows with undecodable (bytes) filename

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 27a3b19ee792 by Victor Stinner in branch 'default':
Issue #15478: Fix compilation on Windows
http://hg.python.org/cpython/rev/27a3b19ee792

--

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



[issue16330] Use surrogate-related macros

2012-10-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 812f5c379188 by Victor Stinner in branch 'default':
Issue #16330: Fix compilation on Windows
http://hg.python.org/cpython/rev/812f5c379188

--

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



[issue12890] cgitb displays p tags when executed in text mode

2012-10-29 Thread Michael Dorman

Michael Dorman added the comment:

Patch (p12890-2.diff) successfully tested on Windows 7 64. No regressions.

--
nosy: +mjdorma

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



[issue15478] UnicodeDecodeError on OSError on Windows with undecodable (bytes) filename

2012-10-29 Thread STINNER Victor

STINNER Victor added the comment:

The commit is incomplete, there are some remaining functions that need to be 
patched: here is a new (untested) patch for more Windows functions.

--
Added file: http://bugs.python.org/file27789/oserror_filename_windows.patch

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



[issue13266] Add inspect.unwrap(f) to easily unravel __wrapped__ chains

2012-10-29 Thread Aaron Iles

Aaron Iles added the comment:

I've updated the patch for the current default branch (to be Python 3.4) and 
added documentation to the inspect module for the new unwraps function. 
Functionally unwraps and it's tests are unchanged.

--
Added file: http://bugs.python.org/file27790/p13266-2.diff

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



[issue16278] os.rename documentation slightly inaccurate

2012-10-29 Thread Todd Rovito

Todd Rovito added the comment:

Over the weekend I verified the test cases are incomplete for Python 3.4.  
Inside of Lib/test/test_os.py is a class FileTests that contains a single 
function test_rename which seems to only check to make sure that the reference 
count for the first argument is not mis-handeled.  Nothing exists for the use 
case destination is a directory as described in the original bug.  I will 
attempt to create suggested test cases but as I am not the most familiar with 
Python's unit test framework it might take me some time, I estimate as long as 
11/6/2012.  If somebody comes along with more experience that can fix the bug 
please feel free to proceed.

--

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



[issue15436] __sizeof__ is not documented

2012-10-29 Thread Stephen Tonkin

Changes by Stephen Tonkin spton...@outlook.com:


--
nosy: +sptonkin

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



[issue15436] __sizeof__ is not documented

2012-10-29 Thread Michael Dorman

Changes by Michael Dorman mjdo...@gmail.com:


--
nosy: +mjdorma

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



[issue8913] Document that datetime.__format__ is datetime.strftime

2012-10-29 Thread Heikki Partanen

Heikki Partanen added the comment:

Grammar fixed

--
Added file: http://bugs.python.org/file27791/issue8913-3.patch

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