[issue19906] Typo in urllib documentation

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2ac7551986ba by Ezio Melotti in branch '2.7':
#19906: clarify note in urllib docs.
http://hg.python.org/cpython/rev/2ac7551986ba

--
nosy: +python-dev

___
Python tracker 

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



[issue19906] Typo in urllib documentation

2014-02-10 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the report and the initial patch!

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

___
Python tracker 

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



[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Ezio Melotti

Ezio Melotti added the comment:

I missed this comment from Serhiy:

> There are too many cases where json and Python syntax differ.

How many differences there are between the two?
I think we might add notes to the table at 
http://docs.python.org/3/library/json.html#encoders-and-decoders (either 
something similar to the notes in the table at 
http://docs.python.org/3/library/stdtypes.html#mutable-sequence-types, or just 
a couple of lines in a third column).  If there are too many differences and we 
follow the specs we can just add a note saying that the decoding is done 
according to the specs, add a link to them, and mention a few examples that are 
valid in Python but not in JSON (like Serhiy did in his message).

--
keywords: +easy
nosy: +terry.reedy

___
Python tracker 

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



[issue20362] longMessage attribute is ignored in unittest.TestCase.assertRegexpMatches etc

2014-02-10 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2014-02-10 Thread Martin Panter

Martin Panter added the comment:

A new “required arguments” section seems too arbitrary to me. It would clash 
with the “positional arguments” heading, since those are also required by 
default.

I would go with the heading “options”, as a noun. That term seems to be well 
used, at least on Linux and Wikipedia (see 
https://en.wikipedia.org/wiki/Command-line_option). Other terms are “flag” and 
“switch”. In this thread I see two arguments against this:

1. Eric Smith prefers to retain the noun “arguments”. How about something like 
“non-positional arguments” then?

2. Steven Bethard is worried about backwards compatibility. I thought the 
Python people were happy to make these sort of changes each minor release (e.g. 
3.4 to 3.5).

The module’s source code uses the term “optionals” a lot more than this one 
heading. It would be clearer if this term were dropped, or only used for things 
that are truly optional. So even if you can’t fix the help output until Python 
4, please fix the documentation and the rest of the source code :)

--
nosy: +vadmium

___
Python tracker 

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



[issue12296] Minor clarification in devguide

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4ce6bfb27267 by Ezio Melotti in branch 'default':
#12296: clarify paragraph about backward-compatibility.  Patch by Moritz Neeb, 
Jyrki Pulliainen, and Éric Araujo.
http://hg.python.org/devguide/rev/4ce6bfb27267

--
nosy: +python-dev

___
Python tracker 

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



[issue12296] Minor clarification in devguide

2014-02-10 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patches!

--
assignee: eric.araujo -> ezio.melotti
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed
versions:  -3rd party

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2014-02-10 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #20433.

--
stage:  -> needs patch
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue20433] add aliasedname() and namedaliases() methods to unicodedata module

2014-02-10 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> committed/rejected
status: pending -> closed

___
Python tracker 

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



[issue20351] Add doc examples for DictReader and DictWriter

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

My point is that Python and JSON are two different languages which have 
different syntaxes. JSON is not Python and Python is not JSON. We can't 
enumerate all differences unless to cite Python [1] and JSON [2] specifications.

For differences from JSON specifications see [3].

[1] http://docs.python.org/3/reference/index.html
[2] http://tools.ietf.org/html/rfc4627.html
[3] http://docs.python.org/3/library/json.html#standard-compliance

--

___
Python tracker 

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



[issue14044] IncompleteRead error with urllib2 or urllib.request -- fine with urllib, wget, or curl

2014-02-10 Thread Martin Panter

Martin Panter added the comment:

The server in question is sending a chunked response, but seems to be closing 
the connection when it is done, without sending a zero-length chunk (which I 
understand it is meant to according to the HTTP protocol).

My Firefox shows the XML without any indication of error. But then if I 
manually truncate a chunked response to Firefox it doesn’t indicate an error 
either, which I would probably want to know about.

--
nosy: +vadmium

___
Python tracker 

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



[issue19974] tarfile doesn't overwrite symlink by directory

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Why did you add so many versions of the same functions? Only 
PyErr_SetExcFromWindowsErrWithFilenameObjects() and 
PyErr_SetFromErrnoWithFilenameObjects() are used.

The Py_UNICODE type is deprecated, you should not add new functions using it in 
Python 3.4.

+PyObject *PyErr_SetFromWindowsErrWithUnicodeFilenames(
+int ierr,
+const Py_UNICODE *filename,
+const Py_UNICODE *filename2)

And you should avoid passing raw bytes string to build an error message, you 
probably has the Python object version of the filename somewhere in your code.

+PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenames(
+PyObject *exc,
+/* decoded from the filesystem encoding */
+const char *filename,
+const char *filename2
+);

+PyObject *PyErr_SetExcFromWindowsErrWithFilenames(
+PyObject *exc,
+int ierr,
+const char *filename,
+const char *filename2)

In Python 3.3, there are also too many functions to raise an OSError, I don't 
that you should so many new functions. Please remove:

- PyErr_SetFromWindowsErrWithUnicodeFilenames
- PyErr_SetFromErrnoWithFilenames
- PyErr_SetExcFromWindowsErrWithFilenames

Having two filenames in OSError is the best fix for functions like os.rename 
when we don't know which path raised the error. I remember that it was hard to 
guess if the source or the destination was the problem, so thanks for working 
on this.

Note: When I wrote "Unicode is really the native type", I mean a PyObject* 
object which is a str, not Py_UNICODE* which is deprecated.

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

___
Python tracker 

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



[issue20579] OS X IDLE keyboard accelerators fail or misbehave with Cocoa Tk

2014-02-10 Thread Ned Deily

New submission from Ned Deily:

On OS X, most of the IDLE command keyboard accelerators that use the OS X 
 modifier key do not work correctly with Cocoa Tk, the current native 
version of Tk 8.5 and 8.6 used on OS X 10.6 and later releases (and with the 
64-/32-bit OS X binary installers from python.org).  These include the event 
bindings found in config-extensions.def:
format-paragraph=
expand-word=
zoom-height=
check-module=
and in config-keys.def (IDLE Classic OSX set): 
save-copy-of-window-as-file = 

These all work (mostly) correctly with the older Carbon Tk, the original 
32-bit-only native Tk for OS X, still shipped as Tk 8.4 in current systems (and 
still used with the 32-bit-only python.org binary installers), which was the Tk 
in use when native support for IDLE on OS X was originally implemented.

Modifier key support in Tk has long been problematic, with significant 
differences among platforms and even among the three implementations of Tk in 
use on OS X (besides the Cocoa and Carbon versions, there is an older OS X X11 
version that differs in some respects from other Unix X11 versions).  Some of 
these differences have their origins lost in the mists of time or were due to 
no-longer relevant operating systems or hardware differences.  On the Tcl/Tk 
wiki, there is a page that attempts to document the differences based on 
empirical evidence (http://wiki.tcl.tk/28331).  Of particular relevance to IDLE 
is that the OS X Tk implementations do not use Alt binding modifiers since 
there was historically no Alt key on Mac keyboards.  In its place the Option 
key and binding modifier is used.  Likewise, the Command/Apple/⌘ key is used in 
place of the Windows key and is a binding modifier.  To that end, on OS X IDLE 
converts  bindings and accelerators to  ones, either during the 
build of IDLE or at run-time.  As noted above, that works pretty well for the 
older, now obsolete Carbon Tk.  However, it doesn't with the newer, current 
Cocoa Tk.  I believe this is primarily because Cocoa Tk supports the more 
sophisticated Cocoa text input system which maps most  key combinations 
either directly to extended characters (like opt-s -> ß on US keyboard input 
methods) or as the first key of a two key composing sequence (e.g. opt-u a -> 
ä).  Cocoa Tk applications do not see these keys as separate events, only the 
final composed character.  Thus, the config-extension bindings above cause 
various characters to be input as text rather than triggering menu options.

The "save-copy-of-window-as-file" binding behaves somewhat differently: when 
typing Opt-Cmd-s, two instances of the Save File popup window appear with Cocoa 
Tk.  That erroneous behavior can be fixed by the straightforward change of the 
binding to .  Similar remapping to unused key bindings 
should be made for the extension bindings and documented accordingly so that 
all keyboard accelerators shown in IDLE menus are actually usable.

(For completeness sake, I'll note that the situation with OS X X11-based Tk in 
conjunction with the OS X XQuartz X server is much more bizarre.  Behavior 
differs depending on server preferences: either the roles of the Option and 
Command key modifiers are reversed or the Option modifier is not usable in Tk 
at all other than as an extended character set composing key.  The Tk wiki page 
documents much of this.  It isn't clear how a Tk application could accommodate 
all these different behaviors automatically so the current strategy of not 
trying to seems prudent.)

--
components: IDLE
messages: 210815
nosy: ned.deily
priority: normal
severity: normal
status: open
title: OS X IDLE  keyboard accelerators fail or misbehave with Cocoa Tk
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue20580] IDLE should support platform-specific default config defaults

2014-02-10 Thread Ned Deily

New submission from Ned Deily:

There is a need for IDLE to provide different default settings depending on 
which platform it is running, e.g. Windows, OS X, or other UNIX.  That need 
need has been most acute for OS X where, for various reasons, tailoring of 
default key bindings for IDLE commands and extensions is either necessary or 
desirable to conform to platform user interface guidlines or, more importantly, 
platform-specific Tk behavior.  For OS X, that customization is provided in 
part by brute force editing of the config-main.def and config-extensions.def in 
Mac/Makefile target install_IDLE which is run during installation of framework 
builds.  While that works for that case, it is brittle and opaque and does not 
help for non-framework OS X installs or when running from a build directory.  
And it doesn't help for other platforms.  Other OS X customization is done at 
run time to convert any  events to  events, since none 
of the OS X Tk implementations support  events (see Issu
 e20579).  It would be better to provide some way to specify these various 
conditional settings directly in config-main.def and config-extensions.def 
themselves, perhaps with platform-specific sections in the files that would be 
merged with and override the current general sections.  For example, in 
config-main.def, a possible implementation might be:

[Keys]
default= 1
name= IDLE Classic Windows

[Keys-OSX]
name= IDLE Classic OSX

[Keys-Unix]
name= IDLE Classic Unix

This might also be used to support different options for different versions of 
IDLE since today all versions by default share the same user configuration 
files.

[Keys]
...

[Keys-2.7]
...

[Keys-3]
...

--
components: IDLE
messages: 210816
nosy: ned.deily
priority: normal
severity: normal
status: open
title: IDLE should support platform-specific default config defaults
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

To me, the JSONDecoder doc at the top of this section
http://docs.python.org/3/library/json.html#encoders-and-decoders
is unclear about decoding process and timing of application and the signature 
of all 5 hook functions. The timing and signature issues are related. My 
questions and suggestions:

- 'Simple JSON decoder.'
+ 'A simple JSON decoder that splits JSON strings into JSON substrings that 
represent programming objects and then converts the substrings into Python 
objects.'

I took the above from Mark's description, using 'substring' instead of 'token'.

- '\nPerforms the following translations in decoding by default:'
+ 'The default translations from JSON object strings to Python objects are as 
follows:'

Should the table have multiple notes?  The intended use case for JSON is 
program to program communication, where both programs 'understand' the legal 
JSON syntax. Is handcrafting JSON strings, without knowing the syntax, also an 
intended usecase?  I think not. Teaching the syntax is out of scope for the 
docs. However, the table could be followed by a generic note that JSON syntax 
and Python syntax for objects are different.

+ "The legal JSON syntax for various classes is different from Python syntax 
for the same classes. The tranformations above are only  applied to legal JSON 
strings. For instance, both float('.5') and float(0.5) are legal Python code, 
but a JSON encoder will only produce '0.5', so a JSON decoder will reject '.5' 
as an error and not pass it on to float() or its parse_float substitute."

This suggestion is intended to replace class by class notes or the proposed 
addition to the parse_float entry.

I think the description of the parse hooks would be clearer if the input 
signature were given immediately with the name.

object_hook: I do not understand enough to suggest anything. Is the input a 
json string representing an object or a Python dict?

object_pairs_hook: Ditto. What is its input?

parse_int: This should come before parse_float, to match the table.

- '*parse_int*, if specified ...'
+ '*parse_int*(*num_str*), if specified ...'

'num_str' as the parameter name is used in the ... part.

parse_float(num_str): ditto

parse_constant(const_str): I do not understand "This can be used to raise an 
exception if invalid JSON numbers are encountered."

>>> def f(s): raise ValueError('custom')
...
>>> json.loads('.5', parse_constant=f)

gives same error as as without parse_constant. The sentence should be rewritten 
or removed.

--

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

The family of "PyErr_SetExcFrom..." functions was used when there were various 
kind of exceptions: select.error, mmap.error, OSError, IOError, socket.error, 
etc. The "PEP 3151: Reworking the OS and IO exception hierarchy" has been 
implemented in Python 3.3. I'm not sure that we need such function anymore, a 
function always raising OSError is probably enough:

"PyErr_SetExcFromWindowsErrWithFilenameObjects" name should be just 
"PyErr_SetFromWindowsErrWithFilenames". I hate such long names :-(

--

___
Python tracker 

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



[issue9694] argparse required arguments displayed under "optional arguments"

2014-02-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions:  -Python 3.2

___
Python tracker 

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



[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

> My point is that Python and JSON are two different languages which have 
> different syntaxes.

That is also the point of the generic note I suggested, which explains the 
consequence of the difference (rejection by JSON parser before calling Python 
constructor), with just one example given.

--

___
Python tracker 

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



[issue17654] IDLE only customizes correctly for OS X when using framework build

2014-02-10 Thread Ned Deily

Ned Deily added the comment:

Here's a patch that refactors many of the OS X customizations in IDLE based on 
more granular criteria, e.g. those that should apply to all Tk implementations 
vs those that depend on specific ones (Cocoa Tk, Carbon Tk, or X11 Tk) rather 
than the bogus current framework test.  This should fix the specific problem of 
the control-click menu not appearing in non-framework builds along with various 
other issues such as missing menu items when using an X11 Tk on OS X.  It does 
not address the issue of providing the OS X specific key set with a 
non-framework build: Issue20580 addresses that.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file34018/issue17654.patch

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Sorry, I have to reopen this topic again, a buildbot failed :-( Builds 10136, 
10134 and 10131 failed on "failure x86 XP-4 3.x" buildbot. It's sporadic 
probably because the test fails sometimes depending how the timing is rounded.

http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/10136/steps/test/logs/stdio

==
FAIL: test_timeout_rounding (test.test_asyncio.test_events.SelectEventLoopTests)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_asyncio\test_events.py",
 line 1185, in test_timeout_rounding
self.assertLessEqual(self.loop._run_once_counter, 8)
AssertionError: 114 not less than or equal to 8

http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/10134/steps/test/logs/stdio

==
FAIL: test_timeout_rounding (test.test_asyncio.test_events.SelectEventLoopTests)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_asyncio\test_events.py",
 line 1185, in test_timeout_rounding
self.assertLessEqual(self.loop._run_once_counter, 8)
AssertionError: 181 not less than or equal to 8

http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/10131/steps/test/logs/stdio

==
FAIL: test_timeout_rounding (test.test_asyncio.test_events.SelectEventLoopTests)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_asyncio\test_events.py",
 line 1185, in test_timeout_rounding
self.assertLessEqual(self.loop._run_once_counter, 8)
AssertionError: 158 not less than or equal to 8

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

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 32dc137f5e26 by Victor Stinner in branch 'default':
Issue #20505: Add debug info to analyze sporaric failures of
http://hg.python.org/cpython/rev/32dc137f5e26

--

___
Python tracker 

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



[issue17654] IDLE only customizes correctly for OS X when using framework build

2014-02-10 Thread Ned Deily

Ned Deily added the comment:

(Just to be clear, the Tk situation on OS X has changed substantially since the 
original customizations were added by Ronald.  So the checks weren't bogus 
initially.  And I've modified some of them subsequently before understanding 
some of the "nuances" of the various Tk implementations.)

--

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

"And you should avoid passing raw bytes string to build an error message, you 
probably has the Python object version of the filename somewhere in your code."

Oh, I remember the reason why char* must not be used to build an OSError: on 
Windows, you should never try to decode a bytes filename, because it may raise 
a UnicodeDecodeError while you are trying to build an OSError. See issue #15478 
for the rationale.

Just pass the original PyObject* you get in path_t. There is even an unit test 
to ensure that OSError.filename is the original name: 
OSErrorTests.test_oserror_filename() in test_os.

--

___
Python tracker 

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



[issue4356] Add "key" argument to "bisect" module functions

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue19871] json module won't parse a float that starts with a decimal point

2014-02-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> - 'Simple JSON decoder.'
> + 'A simple JSON decoder that splits JSON strings into JSON substrings
> that represent programming objects and then converts the substrings
> into Python objects.'

Please let's keep the description simple. Everyone is able to understand
what a JSON decoder is, and your suggested change is strangely confusing
("programming objects"?).

--

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Larry Hastings

Larry Hastings added the comment:

Talked it over with Victor in IRC.  I agree it's best to only add the 
WithFilenameObjects functions, as best practice requires using the original 
PyObject * passed in when creating the OSError.

The attached patch removes all the new WithFilenames and WithUnicodeFilenames 
functions.  Note that I merely amend the existing NEWS entry rather than add a 
new one; the functions only lived in trunk for a couple of hours.

--
Added file: 
http://bugs.python.org/file34019/larry.oserror.remove.with.filenames.etc.1.diff

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

I applied larry.oserror.remove.with.filenames.etc.1.diff on default: On 
Windows, the code compiles fine  and test_os pass.

--

___
Python tracker 

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



[issue20145] unittest.assert*Regex functions should verify that expected_regex has a valid type

2014-02-10 Thread Michael Foord

Michael Foord added the comment:

Agreed.

--

___
Python tracker 

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



[issue20581] Incorrect behaviour of super() in a metaclass-created subclass

2014-02-10 Thread Jérémie Detrey

New submission from Jérémie Detrey:

Dear all,

I've been noticing a strange (and probably incorrect) behaviour of the super() 
function when using a metaclass in order to automatically replace a class 
declaration by a subclass of itself.

In the attached test case, the function `wrap' is used to create such a 
subclass: given the original class `cls' in input, it declares and returns the 
subclass `Wrapper(cls)' whose constructor calls the original one from `cls':

>>> def wrap(cls):
... print("In wrap() for class %s" % cls.__name__)
... name = cls.__name__
... class Wrapper(cls):
... def __init__(self, *args, **kwargs):
... print("In Wrapper(%s).__init__()" % name)
... super().__init__(*args, **kwargs)
... return Wrapper
... 

When `wrap' is used as a decorator (as for class `B' in the test case), the 
correct behaviour is observed: the identifier `B' now represents the 
`Wrapper(B)' subclass, the MRO is as expected (`Wrapper', then the original 
class `B', then `object'), and instantiating a `B' object correctly calls the 
constructors in the right order:

>>> @wrap
... class B:
... def __init__(self):
... print("In B.__init__()")
... super().__init__()
... 
In wrap() for class B
>>> B.mro()
[.Wrapper'>, , ]
>>> B()
In Wrapper(B).__init__()
In B.__init__()
<__main__.wrap..Wrapper object at 0x7fa8c6adb410>

Now, let us automatically call the `wrap' function from a metaclass' `__new__' 
method upon declaration of the class (such as class `A' in the test case):

>>> class Metaclass(type):
... def __new__(meta, name, bases, namespace):
... print("In Metaclass.__new__() for class %s" % name)
... cls = super().__new__(meta, name, bases, namespace)
... return cls if cls.__name__ == 'Wrapper' else wrap(cls)
... 
>>> class A(metaclass = Metaclass):
... def __init__(self):
... print("In A.__init__()")
... super().__init__()
... 
In Metaclass.__new__() for class A
In wrap() for class A
In Metaclass.__new__() for class Wrapper

The MRO still looks correct:

>>> A.mro()
[.Wrapper'>, , ]

However, instantiating the class `A' creates an infinite recursion in the 
original constructor `A.__init__', just as if the `super()' call had somehow 
gotten confused between the original class declared as `A' and its subclass, 
which is now referred to by the identifier `A':

>>> A()
In Wrapper(A).__init__()
In A.__init__()
In A.__init__()
In A.__init__()
In A.__init__()
[...]

Maybe I'm doing something wrong somewhere, but it seems to me that the 
behaviour should at least be the same for classes `A' and `B'.

Kind regards,
Jérémie.

--
components: Interpreter Core
files: bug.py
messages: 210829
nosy: jdetrey
priority: normal
severity: normal
status: open
title: Incorrect behaviour of super() in a metaclass-created subclass
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file34020/bug.py

___
Python tracker 

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



[issue1243678] httplib gzip support

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6343bdbb7085 by Larry Hastings in branch 'default':
Issue #20517: Removed unnecessary new (short-lived) functions from PyErr.
http://hg.python.org/cpython/rev/6343bdbb7085

--

___
Python tracker 

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



[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Larry Hastings

Larry Hastings added the comment:

Buildbots are basically happy with it.  It's checked in.  This was the last 
checkin before 3.4.0rc1 was tagged!

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

___
Python tracker 

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



[issue20572] subprocess.Popen.wait() undocumented "endtime" parameter

2014-02-10 Thread Larry Hastings

Larry Hastings added the comment:

This isn't a release blocker.  And it's not really viable to remove it.

Since it's been in several releases, I suspect our only option is to throw a 
deprecation warning.  And, since deprecations aren't turned on by default, 
maybe the best thing would be to also document it (!) as being deprecated (!!).

Even though rc1 is already tagged and in the process of being released, I will 
accept a patch with the above suggested change for Python 3.4.  If you want to 
do something else talk to me first.

--
priority: release blocker -> normal

___
Python tracker 

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



[issue20572] subprocess.Popen.wait() undocumented "endtime" parameter

2014-02-10 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

> Since it's been in several releases

AFAICT only 3.3. 
Reid, are you willing to provide a patch?

--

___
Python tracker 

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



[issue20581] Incorrect behaviour of super() in a metaclass-created subclass

2014-02-10 Thread Jérémie Detrey

Changes by Jérémie Detrey :


--
versions: +Python 3.3

___
Python tracker 

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



[issue19021] AttributeError in Popen.__del__

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which implements Richard's suggestion: _active now contains 
pid-s instead of Popen instances. But this doesn't fix this issue. Patches for 
issue19255 and issue12085 fixes it.

--
Added file: http://bugs.python.org/file34021/subprocess_active_pids.patch

___
Python tracker 

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



[issue12085] subprocess.Popen.__del__ raises AttributeError if __init__ was called with an invalid argument list

2014-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
type:  -> behavior
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue1573931] WSGI, cgi.FieldStorage incompatibility

2014-02-10 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue20572] subprocess.Popen.wait() undocumented "endtime" parameter

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

I don't think we should document it as deprecated except in What's New.  But a 
code deprecation in 3.4 would be a good idea.

--

___
Python tracker 

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



[issue19157] ipaddress.IPv6Network.hosts function omits network and broadcast addresses

2014-02-10 Thread Michiel

Michiel added the comment:

Hey Peter,

Cool, thanks for the feedback!
Looks like my email replies didn't get attached to the bug tracker..

I've just signed the form.

Regarding the .broadcast* question, I think that's probably best handled in a 
separate issue, but I think there are two other options in addition to the one 
you suggested: a) ensuring the .broadcast_address() function isn't actually 
defined for IPv6Networks (this would also trigger an exception if someone tried 
to call it, like you suggested) or b) making it return the link-local all-nodes 
multicast address. Personally speaking I'd probably favour option a, but I'm 
still new to Python standard library development ;-)

--

___
Python tracker 

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



[issue20581] Incorrect behaviour of super() in a metaclass-created subclass

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

I don't think you can successfully use the no-argument version of super in this 
context.  The no-argument form depends on compile-time magic, and you are 
mucking about with what object is what during the compilation phase.

But I'm no expert on how super works.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2014-02-10 Thread Roy Smith

New submission from Roy Smith:

http://docs.python.org/2/library/socket.html

The description for getnameinfo() says, "... Depending on the settings of 
flags, the result can contain a fully-qualified domain name or numeric address 
representation in host.", but does not say what to pass for flags to get those 
behaviors.

--
assignee: docs@python
components: Documentation
messages: 210838
nosy: docs@python, roysmith
priority: normal
severity: normal
status: open
title: socket.getnameinfo() does not document flags
versions: Python 2.7

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

Like the other socket functions, you have to look it up in the man page.  A 
number of the other functions that take a flag argument mention this in their 
description, so a similar mention should be added to the getnameinfo entry.

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

___
Python tracker 

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



[issue20572] subprocess.Popen.wait() undocumented "endtime" parameter

2014-02-10 Thread Larry Hastings

Larry Hastings added the comment:

My suggestion for documenting it was to document the fact that it's 
unsupported, unrecommended, deprecated, has poor semantics, etc.  If a user 
discovers it, and finds it's not documented, they'll probably think they can 
get away with using it.  If we explicitly document it as "don't use" I think 
that's better.

--

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2014-02-10 Thread Roy Smith

Roy Smith added the comment:

What might make sense is for all of those, document the function call as taking 
"native_flags" (or something like that), with a single note at the top of the 
page saying, "native_flags means look up the specific values in the man page" 
and link to that note each time it's used.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Underscored parameters of functions sometimes are used for different purposes. 
For example see random.Random.randrange(), subprocess.Popen.__del__() or 
codecs.CodecInfo.__new__(). These parameters are not a part of public API and 
should be excluded from help() or pydoc output.

--
components: Library (Lib)
messages: 210842
nosy: ncoghlan, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Hide underscored parameters
type: enhancement

___
Python tracker 

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



[issue20582] socket.getnameinfo() does not document flags

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

I thought about that, but different functions refer to different man pages, and 
it isn't always obvious from the function name which one.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

This is not universally true.  Both namedtuple (for good reason) and email (for 
not-so-good reasons) have _ parameters that are part of the public API.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue4356] Add "key" argument to "bisect" module functions

2014-02-10 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is backported to 3.3 patch. It includes:

1. Operates not with sys.modules['builtins'].__dict__ and 
sys.modules['sys'].__dict__, but with cached interp->builtins and 
interp->sysdict, because sys.modules['builtins'] and sys.modules['sys'] can be 
changed, but builtins and standard streams for builtins are retrieved from 
cached interp->builtins and interp->sysdict.

2. interp->builtins is restored to saved copy.

3. Backported test. Actually it passed with current code, but can prevent 
future bugs.

I'm not sure about (2), but may be (1) should be applied.

--
Added file: http://bugs.python.org/file34022/modules_cleanup-3.3.patch

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

They can be explicitly mentioned in docstrings.

--

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I'm not convinced this should be backported. It's always a bit risky to change 
interpreter shutdown, and it fixes an issue which has been well-known (and 
worked around) for many years.

--

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6a1711c96fa6 by Serhiy Storchaka in branch 'default':
Issue #19255: The builtins module is restored to initial value before
http://hg.python.org/cpython/rev/6a1711c96fa6

--
nosy: +python-dev

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree that it is risky and don't insist. We can return to this patch when 
encounter more serious bug.

Last commit breaks test_create_at_shutdown_without_encoding in test_io for 
Python implementation of io.

This happens because Python implementation of TextIOWrapper.__init__() imports 
the locale module if encoding is not specified. Then _find_spec() in 
Lib/importlib/_bootstrap.py iterates sys.meta_path, but "meta_path" is one of 
names cleared in sys in PyImport_Cleanup().

--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> This happens because Python implementation of TextIOWrapper.__init__()
> imports the locale module if encoding is not specified. Then
> _find_spec() in Lib/importlib/_bootstrap.py iterates sys.meta_path,
> but "meta_path" is one of names cleared in sys in PyImport_Cleanup().

Then perhaps PyImport_Cleanup should call _PyImportHooks_Init instead of
setting import-related attributes to None.

--

___
Python tracker 

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



[issue19255] Don't "wipe" builtins at shutdown

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa160c8145e5 by Serhiy Storchaka in branch 'default':
Temporary silence test broken by issue19255.
http://hg.python.org/cpython/rev/fa160c8145e5

--

___
Python tracker 

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



[issue12085] subprocess.Popen.__del__ raises AttributeError if __init__ was called with an invalid argument list

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 734da14489c1 by Serhiy Storchaka in branch '2.7':
issue12085: Use more Pythonic way to check _child_created.
http://hg.python.org/cpython/rev/734da14489c1

New changeset 79a6300f6421 by Serhiy Storchaka in branch '3.3':
issue12085: Use more Pythonic way to check _child_created.
http://hg.python.org/cpython/rev/79a6300f6421

New changeset a7a62a88380a by Serhiy Storchaka in branch 'default':
issue12085: Use more Pythonic way to check _child_created.
http://hg.python.org/cpython/rev/a7a62a88380a

--

___
Python tracker 

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



[issue12085] subprocess.Popen.__del__ raises AttributeError if __init__ was called with an invalid argument list

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I excluded from patches caching of SubprocessError and OSError, because it 
shouldn't be an issue after committing issue19255. I also removed caching of 
_active because it is explicitly checked for None and it is set to None on 
shutdown with a purpose.

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

___
Python tracker 

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



[issue6815] UnicodeDecodeError in os.path.expandvars

2014-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +needs review

___
Python tracker 

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



[issue20584] On FreeBSD, signal.NSIG is smaller than biggest signal value

2014-02-10 Thread Jan-Philip Gehrcke

New submission from Jan-Philip Gehrcke:

On FreeBSD, signal.NSIG is smaller than what the documentation promises: "One 
more than the number of the highest signal number".

On Linux, the highest numerical signal value is smaller/equal signal.NSIG 
(expected behavior):

>>> import signal
>>> signals = [s for s in dir(signal) if s.startswith("SIG")]
>>> max([(getattr(signal, s), s) for s in signals])
(64, 'SIGRTMAX')
>>> signal.NSIG
65

On FreeBSD (since version 7, when SIGRTMIN/MAX have been introduced), Python's 
signal.NSIG is either 32 (if defined by the system, depending on __BSD_VISIBLE, 
see 
http://svnweb.freebsd.org/base/head/sys/sys/signal.h?revision=233519&view=markup#l331)
 or 64 (if chosen by signalmodule.c as a fallback). In any case, on FreeBSD the 
numerical values of SIGRTMIN/MAX are 65 and 126 and therefore both greater than 
Python's signal.NSIG:
http://svnweb.freebsd.org/base/head/sys/sys/signal.h?revision=233519&view=markup#l117

Consequently, Python's signal module exposes a number NSIG which is not 'true'. 
Two disadvantages:

- signal.NSIG is just not meaningful on FreeBSD. It is part of the signal 
module's public interface, and should do what its documentation says: "One more 
than the number of the highest signal number".

- this might lead to unexpected behavior when for instance calling 
signal.signal(signal.SIGRTMAX, signal.SIG_DFL). This works on Linux, but fails 
with a ValueError on FreeBSD: raised directly by signalmodule.c, because 
sig_num >= NSIG, i.e. sig_num seemingly is an invalid signal number, although 
it is not 
(https://github.com/python/cpython/blob/3.3/Modules/signalmodule.c#L323). This 
is the reason why I became aware of this topic.


I see three arguments here:

- if the system does not provide NSIG via signal.h and Python's signalvalue 
makes the wrong guess (i.e. fallback to 64), then signalmodule.c would be to 
blame.

- if the system provides NSIG via signal.h and this is not the true maximum, 
then one could say that Python is not to blame.

- on the other hand, signalmodule.c is aware of all signals that it actively 
checked for and therefore could derive "One more than the number of the highest 
signal number" on its own via something in the lines of max(signal_values)+1.

Regarding the latter point: if Python misses to check for a valid signal on a 
certain platform, then this actively derived NSIG value would not be entirely 
correct, either, seen from the platform's perspective. But the signal module 
would then at least be consistent with itself.

In case of FreeBSD, I am actually not sure if signal.NSIG *is* provided by the 
system or determined by the fallback method in signalmodule.c (I can't get my 
hands on a FreeBSD machine at the moment).


What do you think?

Btw, parts of this have already been mentioned here: 
http://bugs.python.org/issue12060

--
components: Library (Lib)
messages: 210854
nosy: jgehrcke, neologix, sdaoden
priority: normal
severity: normal
status: open
title: On FreeBSD, signal.NSIG is smaller than biggest signal value
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue19856] shutil.move() can't move a directory in non-empty directory on Windows

2014-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
keywords: +needs review

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I reproduced the issue on my Windows 7 after enabling HPET:

== CPython 3.4.0b3+ (default:1b96d08c3895, Feb 10 2014, 18:44:24) [MSC v.1600 32
 bit (Intel)]
==   Windows-7-6.1.7601-SP1 little-endian
[1/1] test_asyncio
test_timeout_rounding (test.test_asyncio.test_events.ProactorEventLoopTests) ...
 asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
FAIL
test_timeout_rounding (test.test_asyncio.test_events.SelectEventLoopTests) ... a
syncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
asyncio: selector.select(0.100 ms) took 0.000 ms
FAIL

==
FAIL: test_timeout_rounding (test.test_asyncio.test_events.ProactorEventLoopTest
s)
--
Traceback (most recent call last):
  File "C:\haypo\python_default\lib\test\test_asyncio\test_events.py", line 1188
, in test_timeout_rounding
'selector': self.loop._selector.__class__.__name__})
AssertionError: 18 not less than or equal to 8 : {'time_info': namespace(adjusta
ble=True, implementation='GetSystemTimeAsFileTime()', monotonic=False, resolutio
n=0.0156000999), 'selector': 'IocpProactor', 'monotonic_info': namespace
(adjustable=False, implementation='GetTickCount64()', monotonic=True, resolution
=0.0156000999)}

==
FAIL: test_timeout_rounding (test.test_asyncio.test_events.SelectEventLoopTests)

--
Traceback (most recent call last):
  File "C:\haypo\python_default\lib\test\test_asyncio\test_events.py", line 1188
, in test_timeout_rounding
'selector': self.loop._selector.__class__.__name__})
AssertionError: 13 not less than or equal to 8 : {'time_info': namespace(adjusta
ble=True, implementation='GetSystemTimeAsFileTime()', monotonic=False, resolutio
n=0.0156000999), 'selector': 'SelectSelector', 'monotonic_info': namespa
ce(adjustable=False, implementation='GetTickCount64()', monotonic=True, resoluti
on=0.0156000999)}

It looks like GetQueuedCompletionStatus(ms) takes between (ms - 1) and (ms) 
milliseconds. Examples:

GetQueuedCompletionStatus(1 ms)->None took 0.417 ms (monotonic: 0.000 ms)
GetQueuedCompletionStatus(1 ms)->None took 0.307 ms (monotonic: 0.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 1.101 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(10 ms)->None took 9.971 ms (monotonic: 0.000 ms)
GetQueuedCompletionStatus(10 ms)->None took 9.908 ms (monotonic: 15.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 1.634 ms (monotonic: 0.000 ms)

I used time.perf_counter() to measure elapsed time, with elapsed "monotonic" 
time in parenthesis. As you can see, the monotonic clock is usually unchanged 
for such short sleep.

--

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

On the same Windows 7 virtual machine, but with HPET disabled, the test pass.

[1/1] test_asyncio
test_timeout_rounding (test.test_asyncio.test_events.ProactorEventLoopTests) ...
 GetQueuedCompletionStatus(2 ms)->None took 4.350 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(10 ms)->None took 14.737 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 14.700 ms (monotonic: 15.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 12.553 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 15.076 ms (monotonic: 15.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 14.524 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 14.861 ms (monotonic: 16.000 ms)
GetQueuedCompletionStatus(2 ms)->None took 14.617 ms (monotonic: 15.000 ms)
GetQueuedCompletionStatus(0 ms)->None took 0.012 ms (monotonic: 0.000 ms)
ok

As you can see, the elapsed monotonic time if only zero when the timeout was 
zero, otherwise it is at least 15 ms.

So to fix the performance issue on Windows with HPET enabled, I see 3 options:

- round the timeout of GetQueuedCompletionStatus() (asyncio module) and 
select.select() (select module) using the resolution of the clock
- use a more precise clock: time.perf_counter(). I don't like this clock 
because it is not reliable, especially on duration longer than 2 minutes
- reintroduce the granularity in asyncio (and maybe resolution in selectors): 
for this specific issue (Windows with HPET enabled), only the resolution of the 
clock matters in fact

IMO the granularity is the best option because it only modify asyncio and is 
simple. We can try to leave selectors unchanged.

Note: only poll and epoll selectors round away from zero. select and kqueue 
round towards zero. But it's not important IMO.

--

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 20dc8d6430eb by Victor Stinner in branch 'default':
Issue #20505: Use even shorter sleep in test_timeout_rounding() to make the
http://hg.python.org/cpython/rev/20dc8d6430eb

--

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Here is clock_resolution.patch: reintroduce the old "granularity" but only use 
the resolution of the clock (expect the selector to round away from zero).

clock_resolution.patch fixes test_timeout_rounding() on my Windows 7 with HPET 
enabled, even with my more agressive version of the test (test also sleep close 
to nanoseconds, not only close to milliseconds).

Maybe we should also fix #20320: round away from zero for select(), kqueue and 
signal.sigtimedwait().

--
Added file: http://bugs.python.org/file34023/clock_resolution.patch

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Guido van Rossum

Guido van Rossum added the comment:

How do you know that the timer used by the select/poll/etc. call has the same 
resolution?

The variable 'now' should probably be given a more suitable name.

Can the clock resolution be zero? If not, I recommend adjusting the comparisons 
so that an event scheduled at exactly the rounded-up 'now' value is not 
considered ready -- it should be strictly before. (But if the clock resolution 
happens to be zero, an event scheduled at exactly 'now' should be considered 
ready.)

--

___
Python tracker 

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



[issue20585] urllib2 unrelease KQUEUE on Mac OSX 10.9+

2014-02-10 Thread Andrew Gross

New submission from Andrew Gross:

In the latest OSX, 10.9, it looks like there have been some security changes 
related to inheriting file descriptors from parent to child processes.  While 
in the past it would allow you to inherit the parents open FDs, now it will 
kill the process. 

It looks like urllib2 does not properly unsubscribe from the KQUEUE after 
opening a remote connection, causing the process to be killed if you try use 
"evecv" style commands, or fork.

Simple Reproduction:
import urllib2
request = urllib2.urlopen('http://www.python.org')
response = request.read()
request.close()
os.execvp('ssh', ['ssh', 'user@1.2.3.4'])
# Killed: 9

I have attached the diagnostic crash report from OSX, appended to the end is a 
snippet from `lsof` showing the open KQUEUE file descriptor.

--
assignee: ronaldoussoren
components: Library (Lib), Macintosh
files: urllib2.crash
messages: 210860
nosy: Andrew.Gross, ronaldoussoren
priority: normal
severity: normal
status: open
title: urllib2 unrelease KQUEUE on Mac OSX 10.9+
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file34024/urllib2.crash

___
Python tracker 

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



[issue20167] Exception on IDLE closing

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Changes for _SimpleBinder.__del__ look doubtful. Any TclError exception is 
suppressed and "if" statement does nothing. Perhaps you forgot "else: raise"? 
And may be in other places too.

--

___
Python tracker 

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



[issue20585] urllib2 unrelease KQUEUE on Mac OSX 10.9+

2014-02-10 Thread Andrew Gross

Andrew Gross added the comment:

For some additional context on how I came across this bug, check out 
https://github.com/coderanger/pychef/issues/29

--

___
Python tracker 

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



[issue20515] Null pointer dereference in tkinter module

2014-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, in 2.7 varname converter doesn't accept unicode.

Good catch Christian.

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

___
Python tracker 

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



[issue17671] io.BufferedRWPair can use uninitialized members

2014-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
keywords: +needs review

___
Python tracker 

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



[issue20586] Argument Clinic: functions with valid sig but no docstring have no __text_signature__

2014-02-10 Thread Zachary Ware

New submission from Zachary Ware:

Builtins with a valid signature embedded in the docstring, but with no other 
docstring content are not picked up by the __text_signature__ getter because 
the docstring ends with ")\n--" rather than ")\n--\n\n".  The attached patch 
adjusts clinic.CLanguage.docstring_for_c_string to make sure that the rendered 
docstring ends in "--\n\n" rather than "--".

The result is a correct __text_signature__ and a __doc__ of ''.

--
components: Demos and Tools
files: clinic_sig_no_docstring.diff
keywords: patch
messages: 210864
nosy: larry, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Argument Clinic: functions with valid sig but no docstring have no 
__text_signature__
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file34025/clinic_sig_no_docstring.diff

___
Python tracker 

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



[issue19966] Wrong mtimes of Include/Python-ast.h and Python/Python-ast.c in tarballs

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ab0b9107628f by Georg Brandl in branch '3.3':
Closes #19966: allow hgtouch to operate on a base dir that is != the repo root.
http://hg.python.org/cpython/rev/ab0b9107628f

--

___
Python tracker 

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



[issue20374] Failure to compile with readline-6.3-rc1

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a7e048674fef by Ned Deily in branch '3.3':
Issue #20374: Avoid compiler warnings when compiling readline with libedit.
http://hg.python.org/cpython/rev/a7e048674fef

New changeset de02d414590d by Ned Deily in branch '3.3':
Issue #20374: delete spurious empty line
http://hg.python.org/cpython/rev/de02d414590d

--

___
Python tracker 

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



[issue16042] smtplib: unlimited readline() from connection

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d62a67318023 by Georg Brandl in branch '3.3':
#16042: CVE-2013-1752: smtplib fix for unlimited readline() from socket
http://hg.python.org/cpython/rev/d62a67318023

--

___
Python tracker 

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



[issue20311] epoll.poll(timeout) and PollSelector.select(timeout) must round the timeout to the upper bound

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d393df09e139 by Georg Brandl in branch '3.3':
#20311: revert changes to 3.3 branch for now until experts have decided how to 
resolve the issue.
http://hg.python.org/cpython/rev/d393df09e139

--

___
Python tracker 

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



[issue20284] patch to implement PEP 461 (%-interpolation for bytes)

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20586] Argument Clinic: functions with valid sig but no docstring have no __text_signature__

2014-02-10 Thread Zachary Ware

Zachary Ware added the comment:

Forgot to mention, there are no current examples of this checked in.  
winreg.HKEYType has a couple of methods with no docstring (__enter__ and 
__exit__), and _winapi has several docstring-less functions, though.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Yury Selivanov

Yury Selivanov added the comment:

I'm -1 on this.

Yes, there is a convention in Python that _names are kind of private, but it's 
just a convention, and not everybody follow it. Making this change would just 
break too many things.

As for the code in question: Random.randrange -- why does it have this '_int' 
parameter, after all?

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Georg Brandl

Georg Brandl added the comment:

-1 as well.

Yury: it's a micro-optimization, the slow builtin lookup becomes a fast local 
lookup.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue20167] Exception on IDLE closing

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b9e124851e47 by Terry Jan Reedy in branch 'default':
Issue #20167: Add missing else: break in 3 places as noticed by Serhiy.
http://hg.python.org/cpython/rev/b9e124851e47

--

___
Python tracker 

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



[issue20587] sqlite3 converter not being called

2014-02-10 Thread Kathryn M Kowalski

New submission from Kathryn M Kowalski:

I have a timestamp converter that works on 2.5 but doesn't on 2.7.2 
(ActiveState 2.7.2.5  Attached is some pared down test code and output from a 
machine running 2.5 and one running 2.7.  At one point I even put print 
statements in the converter - they show up under 2.5 not 2.7.  I don't think it 
is getting called.

--
components: Windows
files: check_with_output.txt
messages: 210873
nosy: kmk
priority: normal
severity: normal
status: open
title: sqlite3 converter not being called
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file34026/check_with_output.txt

___
Python tracker 

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



[issue19856] shutil.move() can't move a directory in non-empty directory on Windows

2014-02-10 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

First I've reviewed #msg205585 again (no patch applied). Notice that Traceback 
was not accurate:

test_A:

>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo/', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo/', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 291, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/' already exists

test_B:
>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 291, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/foo' already exists


test_C:
>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo\\', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo\\', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 291, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/foo' already exists

--

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> How do you know that the timer used by the select/poll/etc. call has the same 
> resolution?

If I understood correctly, there a 3 kind of clocks on Windows:

- kernel heartbeat: GetSystemTimeAdjustment() gives the resolution (a few 
milliseconds)
- multimedia timers
- performance counter: the resolution is 1 / QueryPerformanceFrequency() (at 
least 1 microsecond)

GetSystemTimeAsFileTime() (time.time), GetTickCount[64]() (time.monotonic) and 
GetProcessTimes() (time.process_time) use the kernel heartbeat (I invented this 
name :-)). GetTickCount() is not adjusted.

QueryPerformanceCounter() is the performance counter, it is used by 
time.perf_counter().

GetSystemTimeAdjustment():
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724394%28v=vs.85%29.aspx

For more information, see the PEP 418:
http://www.python.org/dev/peps/pep-0418/

> Can the clock resolution be zero?

There is a unit test to ensure that the resolution of all clocks is greater 
than 0 and smaller or equal than 1.0.

> If not, I recommend adjusting the comparisons so that an event scheduled at 
> exactly the rounded-up 'now' value is not considered ready -- it should be 
> strictly before.

Ok, here is an updated patch.

--
Added file: http://bugs.python.org/file34027/clock_resolution-2.patch

___
Python tracker 

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



[issue19856] shutil.move() can't move a directory in non-empty directory on Windows

2014-02-10 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

I've applied the patch manually to 2.7. Then I've done the tests again (notice 
test_A traceback):

test_A:
>>> import os, shutil
>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo/', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo/', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 292, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/foo' already exists


test_B:
>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 292, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/foo' already exists

test_C:
>>> os.makedirs('foo')
>>> os.makedirs('bar/foo')
>>> shutil.move('foo\\', 'bar/')

Traceback (most recent call last):
  File "", line 1, in 
shutil.move('foo\\', 'bar/')
  File "D:\programs\Python27\lib\shutil.py", line 292, in move
raise Error, "Destination path '%s' already exists" % real_dst
Error: Destination path 'bar/foo' already exists

--
Added file: 
http://bugs.python.org/file34028/shutil_move_dir_altsep_python27.patch

___
Python tracker 

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



[issue19856] shutil.move() can't move a directory in non-empty directory on Windows

2014-02-10 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

And finally the test runs:

1) The original. No new tests, no new patch.

== CPython 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
==   Windows-7-6.1.7601-SP1 little-endian
==   c:\users\brugue\appdata\local\temp\test_python_5444
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
test_shutil
test_copystat_handles_harmless_chflags_errors (test.test_shutil.TestShutil) ... 
skipped 'requires os.chflags, EOPNOTSUPP & ENOTSUP'
test_copytree_simple (test.test_shutil.TestShutil) ... ok
test_copytree_with_exclude (test.test_shutil.TestShutil) ... ok
test_make_archive (test.test_shutil.TestShutil) ... ok
test_make_archive_cwd (test.test_shutil.TestShutil) ... ok
test_make_archive_owner_group (test.test_shutil.TestShutil) ... ok
test_make_tarball (test.test_shutil.TestShutil) ... ok
test_make_zipfile (test.test_shutil.TestShutil) ... ok
test_on_error (test.test_shutil.TestShutil) ... ok
test_register_archive_format (test.test_shutil.TestShutil) ... ok
test_rmtree_dont_delete_file (test.test_shutil.TestShutil) ... ok
test_rmtree_errors (test.test_shutil.TestShutil) ... ok
test_tarfile_root_owner (test.test_shutil.TestShutil) ... skipped 'Requires grp 
and pwd support'
test_tarfile_vs_tar (test.test_shutil.TestShutil) ... skipped 'Need the tar 
command to run'
test_destinsrc_false_negative (test.test_shutil.TestMove) ... ok
test_destinsrc_false_positive (test.test_shutil.TestMove) ... ok
test_dont_move_dir_in_itself (test.test_shutil.TestMove) ... ok
test_existing_file_inside_dest_dir (test.test_shutil.TestMove) ... ok
test_move_dir (test.test_shutil.TestMove) ... ok
test_move_dir_other_fs (test.test_shutil.TestMove) ... ok
test_move_dir_to_dir (test.test_shutil.TestMove) ... ok
test_move_dir_to_dir_other_fs (test.test_shutil.TestMove) ... ok
test_move_file (test.test_shutil.TestMove) ... ok
test_move_file_other_fs (test.test_shutil.TestMove) ... ok
test_move_file_to_dir (test.test_shutil.TestMove) ... ok
test_move_file_to_dir_other_fs (test.test_shutil.TestMove) ... ok
test_move_dir_caseinsensitive (test.test_shutil.TestCopyFile) ... ok
test_w_dest_close_fails (test.test_shutil.TestCopyFile) ... ok
test_w_dest_open_fails (test.test_shutil.TestCopyFile) ... ok
test_w_source_close_fails (test.test_shutil.TestCopyFile) ... ok
test_w_source_open_fails (test.test_shutil.TestCopyFile) ... ok

--
Ran 31 tests in 0.359s

OK (skipped=3)
1 test OK.

2) New tests, no new patch:
== CPython 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
==   Windows-7-6.1.7601-SP1 little-endian
==   c:\users\brugue\appdata\local\temp\test_python_5724
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
test_shutil
test_copystat_handles_harmless_chflags_errors (test.test_shutil.TestShutil) ... 
skipped 'requires os.chflags, EOPNOTSUPP & ENOTSUP'
test_copytree_simple (test.test_shutil.TestShutil) ... ok
test_copytree_with_exclude (test.test_shutil.TestShutil) ... ok
test_make_archive (test.test_shutil.TestShutil) ... ok
test_make_archive_cwd (test.test_shutil.TestShutil) ... ok
test_make_archive_owner_group (test.test_shutil.TestShutil) ... ok
test_make_tarball (test.test_shutil.TestShutil) ... ok
test_make_zipfile (test.test_shutil.TestShutil) ... ok
test_on_error (test.test_shutil.TestShutil) ... ok
test_register_archive_format (test.test_shutil.TestShutil) ... ok
test_rmtree_dont_delete_file (test.test_shutil.TestShutil) ... ok
test_rmtree_errors (test.test_shutil.TestShutil) ... ok
test_tarfile_root_owner (test.test_shutil.TestShutil) ... skipped 'Requires grp 
and pwd support'
test_tarfile_vs_tar (test.test_shutil.TestShutil) ... skipped 'Need the tar 
command to run'
test_destinsrc_false_negative (test.test_shutil.TestMove) ... ok
test_destinsrc_false_positive (test.test_shutil.TestMove) ... ok
test_dont_move_dir_in_itself (test.test_shutil.TestMove) ... ok
test_existing_file_inside_dest_dir (test.test_shutil.TestMove) ... ok
test_move_dir (test.test_shutil.TestMove) ... ok
test_move_dir_altsep_to_dir (test.test_shutil.TestMove) ... ERROR
test_move_dir_other_fs (test.test_shutil.TestMove) ... ok
test_move_dir_sep_to_dir (test.test_shutil.TestMove) ... ok
test_move_dir_to_dir (test.test_shutil.TestMove) ... ok
test_move_dir_to_dir_other_fs (test.test_shutil.TestMove) ... ok
test_move_file (test.test_shutil.TestMove) ... ok
test_move_file_other_fs (test.test_shutil.TestMove) ... ok
test_move_file_to_dir (test.test_shutil.TestMove) ... ok
test_move_file

[issue20587] sqlite3 converter not being called

2014-02-10 Thread R. David Murray

R. David Murray added the comment:

Can you pare it down further so that it only uses stdlib code?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, since the resolution is 1 nsec on my Ubuntu and OSX systems and 15.6 msec 
on my Windows box, this patch looks fine.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Nick Coghlan

Nick Coghlan added the comment:

For context, codecs.CodecInfo now takes an undocumented "_is_text_encoding"
keyword-only argument to blacklist codecs from TextIOWrapper, str.encode,
bytes.decode etc. Serhiy expressed some concern that users would see that
via Pydoc, believe it was a public API, and then complain when it was
replaced by an official public API in 3.5. I suggested that hiding keyword
only underscore parameters in Pydoc might be an appropriate resolution of
that concern.

This was right around the time the Zope breakage due to relying on a
private parameter was discovered.

Some thoughts:

- you can never hide positional parameters, they affect the signature too
much
- hiding underscore prefixed keyword-only parameters *might* be reasonable
- Guido clarified the Zope breakage likely stemmed from the Python Labs
days when they occasionally blurred the lines between public API and
implementation detail a bit too much while working on both Zope *and* the
standard library
- users are generally aware that if they're relying on an undocumented
interface that starts with an underscore, it's up to them to adjust if it
changes behaviour in the next feature release
- I'm actually OK with the idea of advanced users deciding to blacklist
their own codecs if they so choose

So since making the suggestion originally, I have changed my view from +1
to -0 regarding making this change for keyword-only arguments. I was always
-1 for positional arguments.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Yury Selivanov

Yury Selivanov added the comment:

> Yury: it's a micro-optimization, the slow builtin lookup becomes a fast local 
> lookup.

That's what I thought, thank you.
I think we should discourage use of this pattern (at least in the stdlib). 
There is small to no performance benefit to do that.

And if it's absolutely required to optimize the hell out of function, it's much 
better to just create a protected module attribute:

_int = int

That way, there is almost no performance difference between _int in the 
signature, and _int as a module global.

--

___
Python tracker 

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



[issue20583] Hide underscored parameters

2014-02-10 Thread Yury Selivanov

Yury Selivanov added the comment:

We can *probably* make a convention, that "dunder" parameters are hidden from 
the pydoc.

like 'func(a, b, *, c, __hidden__=True, __int__=int)'

Or simply those that start with '__'. I'd be -0 on that ;)

--

___
Python tracker 

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



[issue14130] memoryview: add multi-dimensional indexing and slicing

2014-02-10 Thread Ian Beaver

Ian Beaver added the comment:

Its not multi-dimensional slicing  to get a subset of objects as in Numpy, but 
more the ability to slice a buffer containing a multi-dimensional array as raw 
bytes.  Buffer objects in Python2.7 are dimensionality naive so it works fine.  
You were correct that I was testing against Python3.2, in Python3.3 the slicing 
of ndim > 1 works, however only for reading from the buffer.  I still can't 
write back into a memoryview object with ndim > 1 in Python 3.3.

Python 2.7.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> type(arr.data)

>>> arr.data[0:10]
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> 

Python 3.2.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> type(arr.data)

>>> arr.data[0:10]
Traceback (most recent call last):
  File "", line 1, in 
NotImplementedError
>>> 

Python 3.3.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> type(arr.data)

>>> arr.data[0:10]

>>> 


However to write data back into a buffer:

Python 2.7.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> arr.data[0:10] = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>>> 

Python 3.2.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> arr.data[0:10] = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Traceback (most recent call last):
  File "", line 1, in 
NotImplementedError
>>> 

Python 3.3.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> arr.data[0:10] = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Traceback (most recent call last):
  File "", line 1, in 
NotImplementedError: memoryview assignments are currently restricted to ndim = 1
>>> 


Also the slice in Python3.3 is not the same as just returning a chunk of raw 
bytes from the memory buffer, instead of a bytes object the indexing behaves 
similar to numpy array indexes and you get the (sub) array items back as Python 
objects.

Python2.7.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> arr.data[0:10]
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
len(bytes(arr.data[0:10]))
10

Python3.3.3:
>>> import numpy as np
>>> arr = np.zeros(shape=(100,100))
>>> arr.data[0:10]

>>> len(bytes(arr.data[0:10]))
8000

This is not a big deal in my case since I already have numpy arrays I can just 
use bytes(arr.flat[start:end]) to scan through the array contents as byte 
chunks, but that would not be possible with just a memoryview object like it 
was with the Python2 buffer object without converting it to something else or 
dropping to ctypes and iterating over the memory addresses and dereferencing 
the contents.

So in Python3.3 its halfway to the functionality in Python2.7, I can send 
chunks of the data through a compressed or encrypted stream, but I can't 
rebuild the data on the other side without first creating a bytearray and 
eating the cost of a copy into a memoryview.  All I really need is a way to 
reconstruct the original memoryview buffer in memory from a stream of bytes 
without having to make a temporary object first and then copy its contents into 
the final memoryview object when it is complete.

--

___
Python tracker 

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



[issue20405] Add io.BinaryTransformWrapper and a "transform" parameter to open()

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6b850722849e by Victor Stinner in branch 'default':
Issue #20505: BaseEventLoop uses again the resolution of the clock to decide if
http://hg.python.org/cpython/rev/6b850722849e

--

___
Python tracker 

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



[issue18956] Document useful functions in ‘pydoc’ module

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> OK, since the resolution is 1 nsec on my Ubuntu

Yeah, Linux always announce 1 nanosecond, even the real resolution is not so 
good:
https://lkml.org/lkml/2012/2/9/100

On Mac OS X, the resolution is also probably hardcoded to 1 nanosecond. (Python 
reads the resolution at runtime on Linux, Mac OS X and Windows.)

Since the granularity is back, why not using also the resolution of the 
selector in asyncio? :-) It would avoid useless calls for free. It can be a 
private attribute if you don't want to make it public. But I don't see why you 
would like to hide such data since time.get_clock_info(name).resolution is the 
same lie (at least on Linux and Mac OS X) :-) It's just a question of exposing 
OS data. No need to compute the effective resolution.

--

___
Python tracker 

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



[issue12916] Add inspect.splitdoc

2014-02-10 Thread Martin Panter

Changes by Martin Panter :


--
nosy: +vadmium

___
Python tracker 

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



[issue20505] Remove resolution from selectors and granularity from asyncio

2014-02-10 Thread Guido van Rossum

Guido van Rossum added the comment:

Please, no. This has to stop.

--

___
Python tracker 

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



  1   2   >