[issue13564] ftplib and sendfile()

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

Charles-François Natali added the comment:

 The transfer won't be faster mainly because it's really I/O bound.
 But it will use less CPU, only because you're making less syscalls.

 Have you actually measured this?


vanilla over Gb/s:
real0m9.035s
user0m0.523s
sys 0m1.412s

block-sendfile over Gb/s:
real0m9.683s
user0m0.253s
sys 0m1.212s

full-sendfile over Gb/s:
real0m9.014s
user0m0.059s
sys 0m1.000s


As you can see, the throughput doesn't vary (the difference in real
time is just part of the variance).
However, the CPU usage (user+sys) is less for block-sendfile than send
loop, and less for full-sendfile than block-sendfile.


vanilla over loopback:
real0m3.200s
user0m0.541s
sys 0m0.702s

block-sendfile over loopback:
real0m2.713s
user0m0.248s
sys 0m0.197s

full-sendfile over loopback:
real0m1.718s
user0m0.055s
sys 0m0.082s


Same thing for loopback, except that here, zero-copy makes a
difference on the throughput because we're not I/O bound, but really
CPU/memory bound (and here sendfile of the complete file really
outperforms block-sendfile).

I don't have access to a 10Gb/s network, but basic math hints that
sendfile could make a difference on the overall throughput.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for the idea.

Please change failobj to default to keep the terminology consistent with 
the pure Python API.  For reference, here's the code from 
collections.MutableMapping:

def setdefault(self, key, default=None):
try:
return self[key]
except KeyError:
self[key] = default
return default

--
nosy: +rhettinger

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



[issue10712] 2to3 fixer for deprecated unittest method names

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There are reasons why Ezio did not include assert*Regexp*-assert*Regex* in his 
patch.

--

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



[issue17360] Regular expressions on mmap'd files can overflow

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps it was fixed in issue10181. Is it reproduced on Python 2.7 build from 
current sources?

--
nosy: +serhiy.storchaka

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



[issue17360] Regular expressions on mmap'd files can overflow

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, this is issue10182.

--

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



[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger

New submission from Raymond Hettinger:

I was working through the problem sets in The Little Book of Semaphores 
(http://www.greenteapress.com/semaphores/downey08semaphores.pdf) and ran into 
an issue because Python's threading.Semaphore has an unnecessary restriction 
against having negative values.

That precludes use cases such as simple barriers (i.e. wait on five signals 
before a wait is released).

Various descriptions of Semaphores allow their counts to be set to arbitrary 
integer values.  Here's one definition:

   1. When you create the semaphore, you can initialize its 
  value to any integer, but after that the only operations 
  you are allowed to perform are increment (increase by one) 
  and decrement (decrease by one). You cannot read the current
  value of the semaphore.
   2. When a thread decrements the semaphore, if the result is negative,
  the thread blocks itself and cannot continue until another 
  thread increments the semaphore.
   3. When a thread increments the semaphore, if there are other 
  threads waiting, one of the waiting threads gets unblocked.

The patch is simple, remove the guard in the initialization and change the 
value==0 test with value=0 to trigger blocking.

A bit of demonstration code is attached.

--
components: Library (Lib)
files: barrier.py
messages: 183642
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Remove restriction against Semaphore having a negative value
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29334/barrier.py

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



[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +pitrou

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



[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

For reference, here is the Java API for a Semaphore ( 
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Semaphore.html
 ):

Semaphore
-
public Semaphore(int permits)

Creates a Semaphore with the given number of permits and nonfair fairness 
setting.

Parameters:

permits - the initial number of permits available. This value may be negative, 
in which case releases must occur before any acquires will be granted.

--

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



[issue17366] os.chdir win32

2013-03-07 Thread Tim Golden

Tim Golden added the comment:

Dave, you seem to misunderstand what's happening here: the os.chdir
function doesn't have access to the characters which are typed in
the script or in the interpreter. It receives a Python string object.
The parser etc. which constructs the string object determines which
characters are special, which are not, and so on. It also takes
account of special prefixes such as r, u and so on. Neither of
these two things knows about the other. The parser doesn't know
anything about the use the string will be put to; the os.chdir code
doesn't know anything about the origins of the string it's receiving.

This is true of Python and I doubt that it's very different for any
other language you care to name. It's certainly true -- mutatis mutandis
-- of C where *exactly* the same issue applies. Here's the
MSDN page for the MS CRT _chdir function:

  http://msdn.microsoft.com/en-us/library/bf7fwze1(v=vs.80).aspx

In the example half way down, you can see the warning about single
backslashes.

Every language brings its learning points. In Python, if you want
to include backslashes in a literal string, you need to prefix that
string with an r prefix, eg rc:\temp. Speaking as someone who
uses Python on Windows on a daily basis and has done so for some years,
this really isn't an issue once you're over the initial Why did that
not work? blip. Using forward slashes is often a perfectly good way,
sometimes not.

In short, whatever else this is, it's not a Python bug and it's not
going to change in the near future. I freely admit that the Python
world is dominated by Unix-types for whom backslashes have little
significance, and that can colour the emphasis which are given to
some things but Python is very far from unworkable on Windows.

TJG

On 06/03/2013 21:38, Dave Humphries wrote:
 
 Dave Humphries added the comment:
 
 Hi Amaury,
 As I can't reopen the bug I will have to add it here (or open a new bug 
 report).
 
 The issue was about the string used in os.chdir() particularly.
 While this is expected behaviour in a python string it is not expected
 behaviour from a well formed file path:
 1. \t and \n are errors when used in a path.
 2. A well formed Windows path with directories that start with a t or
 n is interpreted as tabs and line feeds by Python. That is certainly
 not expected behaviour in Windows this also means that any Python
 built in method that uses the os.chdir() with a standard format
 environment variable or registry setting will fail with the same
 issue. It also sounds like any os module method will also be affected.
 3. This issue took 1/2 hr to resolve. This makes python unreliable to
 use on Windows with a difficult to find bug.
 
 The suggestion of using forward slashes is unworkable when the scripts
 will be used across a range of computers where environment or registry
 variables get used.
 
 My suggestion is that the os methods get rewritten so that path
 parsing rules match the expected behaviour for the platform.
 
 Regards,
 Dave
 
 On Wed, Mar 6, 2013 at 7:50 PM, Amaury Forgeot d'Arc
 rep...@bugs.python.org wrote:

 Amaury Forgeot d'Arc added the comment:

 The backslash \ has a special meaning in strings: \n is the new line 
 character, and \t is the tab character: 
 http://docs.python.org/2/reference/lexical_analysis.html#string-literals

 Try to print the string!
 You could use \\, or raw strings rlike this.
 Or just use forward slashes / which are allowed by Windows.

 --
 nosy: +amaury.forgeotdarc
 resolution:  - invalid
 status: open - closed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17366
 ___
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17366
 ___
 ___
 Python-bugs-list mailing list
 Unsubscribe: 
 http://mail.python.org/mailman/options/python-bugs-list/mail%40timgolden.me.uk


--
nosy: +tim.golden

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



[issue17375] Add docstrings to methods in the threading module

2013-03-07 Thread Raymond Hettinger

New submission from Raymond Hettinger:

It should be an easy task fill-in the missing docstrings using the verbiage in 
the regular docs.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 183645
nosy: docs@python, rhettinger
priority: normal
severity: normal
status: open
title: Add docstrings to methods in the threading module
versions: Python 3.3, Python 3.4

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



[issue16321] Move eq.h out of stringlib

2013-03-07 Thread moijes12

moijes12 added the comment:

Changes made according to the Sehiy's last comment. Include/Python.h has not 
been modified as it doesn't need one. Also, make files have been changed.

--
keywords: +patch
nosy: +moijes12
Added file: http://bugs.python.org/file29335/16321.patch

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



[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

  3. When a thread increments the semaphore, if there are other 
 threads waiting, one of the waiting threads gets unblocked.
Is a condition missing here? if the resulting count is positive

Since the use case is different from a regular Semaphore, I think it make sense 
to have a new Barrier class.  It's not obvious for me why I need (1-n) to wait 
for n completed tasks.

--
nosy: +amaury.forgeotdarc

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



[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

We already have a Barrier class actually: 
http://docs.python.org/dev/library/threading.html#barrier-objects

As for accepting negative initialization values, it sounds like a reasonable 
request. One reason for rejecting would be if it makes writing a fast 
implementation harder. Also, multiprocessing.Semaphore should be kept 
compatible with threading.Semaphore.

--
nosy: +neologix, sbt

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



[issue17366] os.chdir win32

2013-03-07 Thread Dave Humphries

Dave Humphries added the comment:

Thanks for the thoughtful response Tim,
I am obviously not being clear with the way I express this. os.chdir
uses a common string but these strings represent a special subset of
strings. I'm not sure about mac and linux but windows has arrange of
characters that cannot appear in a path amoung them \t and \n.

My expectation was that a platform os.chdir would parse the string for
these characters and do something intelligent with them i.e a legal
path from any of the systems (mac, linux or windows) passed in as a
string to os.chdir would be converted to something that worked
correctly. This is obviously a bigger challenge than it appears on the
surface.

I will attempt to write some code that will work around this for my
use but I am wondering how other code resolves this issue (currently I
have an environment variable used by a python app written by some else
that seems to be suffering with this and the only solution seems to be
renaming directories).

This seems to place a large unseen burden on developers trying to
write cross-platform scripts that will work.

Thanks again

Dave

 Thu, Mar 7, 2013 at 8:11 PM, Tim Golden rep...@bugs.python.org wrote:

 Tim Golden added the comment:

 Dave, you seem to misunderstand what's happening here: the os.chdir
 function doesn't have access to the characters which are typed in
 the script or in the interpreter. It receives a Python string object.
 The parser etc. which constructs the string object determines which
 characters are special, which are not, and so on. It also takes
 account of special prefixes such as r, u and so on. Neither of
 these two things knows about the other. The parser doesn't know
 anything about the use the string will be put to; the os.chdir code
 doesn't know anything about the origins of the string it's receiving.

 This is true of Python and I doubt that it's very different for any
 other language you care to name. It's certainly true -- mutatis mutandis
 -- of C where *exactly* the same issue applies. Here's the
 MSDN page for the MS CRT _chdir function:

   http://msdn.microsoft.com/en-us/library/bf7fwze1(v=vs.80).aspx

 In the example half way down, you can see the warning about single
 backslashes.

 Every language brings its learning points. In Python, if you want
 to include backslashes in a literal string, you need to prefix that
 string with an r prefix, eg rc:\temp. Speaking as someone who
 uses Python on Windows on a daily basis and has done so for some years,
 this really isn't an issue once you're over the initial Why did that
 not work? blip. Using forward slashes is often a perfectly good way,
 sometimes not.

 In short, whatever else this is, it's not a Python bug and it's not
 going to change in the near future. I freely admit that the Python
 world is dominated by Unix-types for whom backslashes have little
 significance, and that can colour the emphasis which are given to
 some things but Python is very far from unworkable on Windows.

 TJG

 On 06/03/2013 21:38, Dave Humphries wrote:

 Dave Humphries added the comment:

 Hi Amaury,
 As I can't reopen the bug I will have to add it here (or open a new bug 
 report).

 The issue was about the string used in os.chdir() particularly.
 While this is expected behaviour in a python string it is not expected
 behaviour from a well formed file path:
 1. \t and \n are errors when used in a path.
 2. A well formed Windows path with directories that start with a t or
 n is interpreted as tabs and line feeds by Python. That is certainly
 not expected behaviour in Windows this also means that any Python
 built in method that uses the os.chdir() with a standard format
 environment variable or registry setting will fail with the same
 issue. It also sounds like any os module method will also be affected.
 3. This issue took 1/2 hr to resolve. This makes python unreliable to
 use on Windows with a difficult to find bug.

 The suggestion of using forward slashes is unworkable when the scripts
 will be used across a range of computers where environment or registry
 variables get used.

 My suggestion is that the os methods get rewritten so that path
 parsing rules match the expected behaviour for the platform.

 Regards,
 Dave

 On Wed, Mar 6, 2013 at 7:50 PM, Amaury Forgeot d'Arc
 rep...@bugs.python.org wrote:

 Amaury Forgeot d'Arc added the comment:

 The backslash \ has a special meaning in strings: \n is the new line 
 character, and \t is the tab character: 
 http://docs.python.org/2/reference/lexical_analysis.html#string-literals

 Try to print the string!
 You could use \\, or raw strings rlike this.
 Or just use forward slashes / which are allowed by Windows.

 --
 nosy: +amaury.forgeotdarc
 resolution:  - invalid
 status: open - closed

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

 --

 

[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

_Py_GetRefTotal() wouldn't be available in non-debug builds IIRC.

--
nosy: +pitrou

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



[issue9556] Specifying the time a TimedRotatingFileHandler rotates

2013-03-07 Thread Tshepang Lekhonkhobe

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


--
nosy: +tshepang

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



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue17374] Remove restriction against Semaphore having a negative value

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

Charles-François Natali added the comment:

 As for accepting negative initialization values, it sounds like a reasonable 
 request. One reason for rejecting would be if it makes writing a fast 
 implementation harder. Also, multiprocessing.Semaphore should be kept 
 compatible with threading.Semaphore.

Unfortunately, POSIX semaphore don't support negative initial value.
Multiprocessing semaphores are based on POSIX semaphores on Unix, and
one can imagine an alternate implementation of Semaphore based atop
POSIX semaphores.

--

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



[issue17376] TimedRotatingFileHandler documentation regarding 'Week day' lacking

2013-03-07 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe:

Usage of 'W' type is not clear from reading the documentation, specifically how 
to specify what day-of-week: Doc/library/logging.handlers.rst:291.

An example http://stackoverflow.com/q/14304954/321731.

--
assignee: docs@python
components: Documentation
messages: 183652
nosy: docs@python, tshepang
priority: normal
severity: normal
status: open
title: TimedRotatingFileHandler documentation regarding 'Week day' lacking
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue17377] JSON module in standard library behaves incorrectly on input like a psutil constant

2013-03-07 Thread Sven Slootweg

New submission from Sven Slootweg:

When faced with a subclass of int like a psutil constant (such as for process 
status), that actually returns a non-numeric string when used with str(), the 
JSON module will serialize it as a string without quotes.

An example... Code (Python):

[...] key: psutil._common.constant(0, value), otherkey: real string  
[...]

Output (JSON):

[...] key: value, otherkey: real string [...]

Due to the missing quotes around 'value', the JSON data is corrupted.

The cause appears to be that the JSON module, when faced with an int (or 
subclass thereof), will use the string representation in the serialized data, 
which would normally be the integer as a string. This example uses a psutil 
constant, but this would occur with any int subclass that doesn't return itself 
as string representation.

I'm not entirely sure how to resolve this issue or whether it can be resolved 
at all, as all possible solutions appear to have negative side-effects for more 
common cases. I'd imagine that checking whether the resulting string is 
numeric, besides being error-prone, would also cause unreasonable overhead 
during serialization.

--
components: Library (Lib)
messages: 183653
nosy: joepie91
priority: normal
severity: normal
status: open
title: JSON module in standard library behaves incorrectly on input like a 
psutil constant
type: behavior
versions: Python 2.7

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



[issue13564] ftplib and sendfile()

2013-03-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

It seems you're right, sorry. We need to take that into account then.

In the meantime I rewrote the original patch and got rid of the use_sendfile 
explicit argument in order to attempt to use sendfile() by default and fall 
back on using send() if bytes sent were 0.

TSL_FTP related changes are still left out for now as I'm planning a little 
refactoring first.

--
Added file: http://bugs.python.org/file29336/ftplib-sendfile2.patch

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



[issue13564] ftplib and sendfile()

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

Charles-François Natali added the comment:

 In the meantime I rewrote the original patch and got rid of the 
 use_sendfile explicit argument in order to attempt to use sendfile() by 
 default and fall back on using send() if bytes sent were 0.


# block until socket is writable
select.select([], [sockno], [])


I don't get it, why do you use select?

--

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Ankur Ankan

Ankur Ankan added the comment:

Thanks for your comments Serhiy.
I have improved the patch according to your comments. Please have a look.

And I am writing tests.

--
Added file: http://bugs.python.org/file29337/issue_13477_v2

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



[issue17375] Add docstrings to methods in the threading module

2013-03-07 Thread karl

karl added the comment:

Here an attempt at fixing it. See issue-17375-1.patch for Python 3.3

Hope it helps.

--
keywords: +patch
nosy: +karlcow
Added file: http://bugs.python.org/file29338/issue-17375-1.patch

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



[issue17375] Add docstrings to methods in the threading module

2013-03-07 Thread Eli Bendersky

Eli Bendersky added the comment:

Duplicate of #12768?

karl - feel free to review the patch submitted to that issue and offer your 
insights.

--
nosy: +eli.bendersky

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



[issue17375] Add docstrings to methods in the threading module

2013-03-07 Thread karl

karl added the comment:

Ah bummer! :) it was already done. :) Well it seems already well commented in 
the review. :)

Closing this one as duplicate?

--

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



[issue15465] Improved documentation for C API version info

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset adeafab9a18f by Nick Coghlan in branch '3.3':
Close #15465: Document C API version macros
http://hg.python.org/cpython/rev/adeafab9a18f

New changeset a1373861f62f by Nick Coghlan in branch 'default':
Merge fix for #15465 from 3.3
http://hg.python.org/cpython/rev/a1373861f62f

--
nosy: +python-dev
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue17378] Document that ctypes automatically applies byref() when argtypes declares POINTER

2013-03-07 Thread Eli Bendersky

New submission from Eli Bendersky:

While playing with ctypes a bit, I noticed a feature that doesn't appear to be 
documented. Suppose I import the readdir_r function (assuming DIRENT is a 
correctly declared ctypes.Structure):

DIR_p = c_void_p
DIRENT_p = POINTER(DIRENT)
DIRENT_pp = POINTER(DIRENT_p)

readdir_r = lib.readdir_r
readdir_r.argtypes = [DIR_p, DIRENT_p, DIRENT_pp]
readdir_r.restype = c_int

It seems that I can then call it as follows:

dirent = DIRENT()
result = DIRENT_p()

readdir_r(dir_fd, dirent, result)

Note that while readdir_r takes DIRENT_p and DIRENT_pp as its second and third 
args, I pass in just DIRENT and DIRENT_p, accordingly. What I should have done 
is use byref() on both, but ctypes seems to have some magic applied when 
argtypes declares pointer types. If I use byref, it still works. However, if I 
keep the same call and comment out the argtypes declaration, I get a segfault.

This behavior of ctypes should be documented.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 183661
nosy: docs@python, eli.bendersky
priority: normal
severity: normal
stage: needs patch
status: open
title: Document that ctypes automatically applies byref() when argtypes 
declares POINTER
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

The problem with 'default' is that it is a reserved word in C. I changed it to 
defaultobj, except for the docs page, where default should work. I also 
removed the register declaration from the mp argument because it is most 
likely useless and just takes up screen real estate.

--
Added file: http://bugs.python.org/file29339/pydict_setitemdefault.patch

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



[issue17378] Document that ctypes automatically applies byref() when argtypes declares POINTER

2013-03-07 Thread Eli Bendersky

Eli Bendersky added the comment:

Doc patch for 3.2

--
keywords: +patch
Added file: http://bugs.python.org/file29340/issue17378.1.patch

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



[issue17378] Document that ctypes automatically applies byref() when argtypes declares POINTER

2013-03-07 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


--
nosy: +amaury.forgeotdarc, theller

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



[issue17377] JSON module in standard library behaves incorrectly on input like a psutil constant

2013-03-07 Thread R. David Murray

R. David Murray added the comment:

Right, the appropriate thing to do there is to write a custom encoder/decoder 
to handle those objects.  json only automatically handles types that work like 
the fundamental types, and this is a good thing, security-wise :)

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

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



[issue16576] ctypes: structure with bitfields as argument

2013-03-07 Thread Eli Bendersky

Eli Bendersky added the comment:

The patch addresses issue16575 as well

--
nosy: +theller

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



[issue13564] ftplib and sendfile()

2013-03-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

It's necessary because sendfile() can fail with EAGAIN.

As for your blocksize = filesize argument I changed my opinion: despite being 
less CPU consuming we might incur into problems if that number is too big.  
'count' parameter on Linux, for example, is expected to be an unsigned int.
Other plarforms will also use different data types so we better stick with a 
fixed blocksize value (currently 8192).

--

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



[issue17376] TimedRotatingFileHandler documentation regarding 'Week day' lacking

2013-03-07 Thread karl

karl added the comment:

Is it better like this? See the patch.

--
keywords: +patch
nosy: +karlcow
Added file: http://bugs.python.org/file29341/issue-17376-doc-3.3.patch

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



[issue13564] ftplib and sendfile()

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

Charles-François Natali added the comment:

 It's necessary because sendfile() can fail with EAGAIN.

It can fail with EAGAIN if the input FD is non-blocking, exactly like
the current implementation which calls fp.read(). Furthermore, since
sendfile actually supports only regular file and regular files don't
support non-blocking I/O, it's unlikely to ever happen.

 As for your blocksize = filesize argument I changed my opinion: despite 
 being less CPU consuming we might incur into problems if that number is too 
 big.  'count' parameter on Linux, for example, is expected to be an unsigned 
 int.

'count'  is size_t, like for mmap() and any other function accepting a
length, so nothing wrong can happen.
A platform which would have a sendfile prototype which doesn't support
sending a complete file at once would be completely broken...

--

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



[issue17378] Document that ctypes automatically applies byref() when argtypes declares POINTER

2013-03-07 Thread Thomas Heller

Thomas Heller added the comment:

Patch looks good.  Please apply.

--

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



[issue13564] ftplib and sendfile()

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 As for your blocksize = filesize argument I changed my opinion:
 despite being less CPU consuming we might incur into problems if
 that number is too big.  'count' parameter on Linux, for example, is
 expected to be an unsigned int.
 Other plarforms will also use different data types so we better stick
 with a fixed blocksize value (currently 8192).

If you really think a blocksize is necessary, you could choose a much
larger one for sendfile() (such as 16 MB). Then the overhead of system
calls would be much smaller.

--

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



[issue17379] Zen amendment

2013-03-07 Thread Christian Heimes

New submission from Christian Heimes:

Tim came up  with a fitting amendment to the Zen of Python. It pretty much sums 
up our future Code of Conduct in one sentence. But see for yourself! ;)

--
files: zen_amendment.patch
keywords: patch
messages: 183671
nosy: christian.heimes, tim_one
priority: normal
severity: normal
stage: patch review
status: open
title: Zen amendment
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29342/zen_amendment.patch

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



[issue15873] datetime cannot parse ISO 8601 dates and times

2013-03-07 Thread Anders Hovmöller

Anders Hovmöller added the comment:

I've written a parser for ISO 8601: https://github.com/boxed/iso8601

Some basic tests are included and it supports most of the standard. Haven't 
gotten around to the more obscure parts like durations and intervals, but those 
are trivial to add...

--
nosy: +Anders.Hovmöller

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



[issue13564] ftplib and sendfile()

2013-03-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 'count'  is size_t, like for mmap() and any other function accepting a 
 length, so nothing wrong can happen.

Then why 'offset' and 'count' parameters have a different data type?

Linux: 
sendfile(..., off_t *offset, size_t count);

Solaris:
sendfile(..., off_t *off,size_t len);

HP-UX:
sendfile(..., off_t offset,  bsize_t nbytes);


 A platform which would have a sendfile prototype which doesn't support
 sending a complete file at once would be completely broken...

You can't send a complete file at once in the first place unless it's very 
small. 
The usual way to send a file is chunk by chunk, so it wouldn't surprise me if 
sendfile() prototype does not support the use case you're describing.
Anyway, Antoine's suggestion makes sense to me: it's probably ok to just use a 
big value and be done with it.
16MB looks a little bit too much to me as the maximum amount of bytes sent per 
call is a lot less than 1MB, but even then it would probably be ok.


 It's necessary because sendfile() can fail with EAGAIN.
 It can fail with EAGAIN if the input FD is non-blocking

It will. Try it yourself.


 Furthermore, since sendfile actually supports only regular file and regular 
 files don't support non-blocking I/O, it's unlikely to ever happen.

EAGAIN is caused by the socket fd not being ready yet, not the file fd.
Please try the patch before making such assumptions. We're going OT here.

--

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



[issue17379] Zen amendment

2013-03-07 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue17379] Zen amendment

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Disagreed. This is the kind of sentence that cannot be correctly
understood without the (missing) original context.

It is also, IMHO, a rather poor wording. The categories of civilized
and barbarian, as any kind of binary thinking (us vs. them) are routinely
used to diminish foreign or dominated cultures (or worse, think about
colonialism). I think they shouldn't be related with either a CoC, or the
more general efforts towards diversity.

The evolution of the meaning of barbarian should shed a light:
http://en.wikipedia.org/wiki/Barbarian

--
nosy: +pitrou

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



[issue17379] Zen amendment

2013-03-07 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Mar 07, 2013, at 03:58 PM, Antoine Pitrou wrote:

Disagreed. This is the kind of sentence that cannot be correctly
understood without the (missing) original context.

Plus, we fear change. ;)

--

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It will be good if Berker and Ankur will merge their patches. Ankur's patch has 
some very useful features, but Berker's patch looks more mature.

I prefer to emulate a subset of the tar utility interface too.

--

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



[issue8402] Add a function to escape metacharacters in glob/fnmatch

2013-03-07 Thread Matthew Barnett

Matthew Barnett added the comment:

I've attached fnmatch_implementation.py, which is a simple pure-Python 
implementation of the fnmatch function.

It's not as susceptible to catastrophic backtracking as the current re-based 
one. For example:

fnmatch('a' * 50, '*a*' * 50)

completes quickly.

--
nosy: +mrabarnett
Added file: http://bugs.python.org/file29343/fnmatch_implementation.py

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



[issue17379] Zen amendment

2013-03-07 Thread R. David Murray

R. David Murray added the comment:

Yeah, but in this case I think Antoine is right.  This kind of argument is 
the kind of argument that is used to shut down discussion, in form whether or 
not in substance.  Which is too bad, because it is nicely clever.

--
nosy: +r.david.murray

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



[issue11732] Skip decorator for tests requiring manual intervention on Windows

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ccefddc13fd by Ezio Melotti in branch '3.3':
#11732: make suppress_crash_popup() work on Windows XP and Windows Server 2003.
http://hg.python.org/cpython/rev/6ccefddc13fd

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

--

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



[issue8402] Add a function to escape metacharacters in glob/fnmatch

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it should be a separate issue.

--

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



[issue13564] ftplib and sendfile()

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

Charles-François Natali added the comment:

 Then why 'offset' and 'count' parameters have a different data type?

Because offsets can be negative (e.g. for lseek), while a size can't.
That's why 'count' is size_t, not ssize_t.

 Furthermore, since sendfile actually supports only regular file and regular
 files don't support non-blocking I/O, it's unlikely to ever happen.

 EAGAIN is caused by the socket fd not being ready yet, not the file fd.
 Please try the patch before making such assumptions.

I didn't see the socket could be set to non-blocking.

In that case, there's a problem with the patch, since select can block
arbitrarily long because it doesn't take the socket timeout into
account.

Also, apparently socket.sendall() doesn't retry on EAGAIN, it doesn't
use BEGIN_SELECT_LOOP.
The risk of false positive (EAGAIN after select reported ready)
shouldn't be as bad as for sendto(), since usually you'll just get a
partial write for a stream oriented socket, but this could be bad for
e.g. a SCTP socket (since it's message-oriented).

  We're going OT here.

I'm leaving this topic, you can do as you like...

--

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



[issue13564] ftplib and sendfile()

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

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


--
nosy:  -neologix

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Éric Araujo

Éric Araujo added the comment:

I am more in favor of having something simple and similar to zipfile, like 
Lars, rather than following tar.

--

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



[issue11732] Skip decorator for tests requiring manual intervention on Windows

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0c440dcb8dd by Ezio Melotti in branch '3.2':
#11732: add a new suppress_crash_popup() context manager to test.support that 
disables crash popups on Windows and use it in test_ctypes.
http://hg.python.org/cpython/rev/c0c440dcb8dd

New changeset 89d62bc81e47 by Ezio Melotti in branch '3.3':
#11732: null merge with 3.2.
http://hg.python.org/cpython/rev/89d62bc81e47

New changeset 7e818490d297 by Ezio Melotti in branch 'default':
#11732: null merge with 3.3.
http://hg.python.org/cpython/rev/7e818490d297

--

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This can confuse users. Note that even jar (which works with zip-like files) 
honors tar interface.

--

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



[issue11732] Skip decorator for tests requiring manual intervention on Windows

2013-03-07 Thread Ezio Melotti

Ezio Melotti added the comment:

GetErrorMode wasn't available on XP/2k3, so I changed the patch to use only 
SetErrorMode.  I also backported it to 3.2, since ctypes has the same crashing 
test of 3.3/default.
If I got everything right there shouldn't be anymore crash popups while running 
the tests, however I haven't tested this on 2.7/3.2, so there might be other 
popups that I missed.  If there are, feel free to reopen the issue.

--
nosy: +terry.reedy
versions: +Python 3.2

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2013-03-07 Thread B. Kyven

B. Kyven added the comment:

I now realized LWPCookieJar is a subclass of CookieJar but it behaves 
differently. I believe there are other quirks I haven't discovered, like 
expire=None which cause exception in LWPCookieJar, but works fine for 
CookieJar. Sadly the doc didn't mention them.

The official python document introduced 2 file cookiejar, one is Mozilla's 
FileCookieJar, which is explicitly advised as depricated.
LWPCookieJar which is human-readable seems the only advisable chooice to me. 
But it turns out not that simple.
My guess is that not many people use this module, or the expire=None problem 
and this dot question should be quite easy to spot on google. 

So forks, could your suggest how does other python user deal with cookie 
storage. Do they just pickle the cookie objects and save to file?
Or any via 3rd party cookie batteries? What's their pro/cons ? 

LWPCookie's usage is strage to me and ,I believe, many average users, I guess 
many people like me will be willing to know alternatives.

--

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



[issue17323] Disable [X refs, Y blocks] ouput in debug builds

2013-03-07 Thread Ezio Melotti

Ezio Melotti added the comment:

Yes -- I was proposing to make it available on non-debug builds too, unless it 
has a negative impact on the performance or other similar issues.

--

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Yeah, that’s always the discussion when writing a Python utility that has a 
unix equivalent: do you want to be familiar to Python users or to the unix tool 
users?

I don’t have a strong opinion.  I think unix users would have no reason to use 
python -m tarfile, and windows users won’t have the expectation that the 
interface is the same as tar—unless they are unix people who are using a 
windows machine for whatever reason.  If it were me, I’d just start with python 
-m tarfile --help, so I’d have no expectations :)

--

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



[issue17380] initproc return value is unclear

2013-03-07 Thread Zbyszek Jędrzejewski-Szmek

New submission from Zbyszek Jędrzejewski-Szmek:

initproc is declared to return an int, but what returned values mean is not 
documented. Noddy_init in 
http://docs.python.org/3/extending/newtypes.html?highlight=initproc#adding-data-and-methods-to-the-basic-example
 can be seen to return 0 on success and -1 on error, but that's about it.

Also, when I wrote a function which return 1 on error, on every second 
invocation the exception would be ignored:
static int Reader_init(Reader *self, PyObject *args, PyObject *keywds)
{
...
if (flags  path) {
PyErr_SetString(PyExc_ValueError, cannot use both flags and path);
return 1;
}
...
}

 obj(123, '/tmp')
 obj(123, '/tmp')
...
ValueError
 obj(123, '/tmp')
 obj(123, '/tmp')
...
ValueError

I'm not sure how to interpret this since I couldn't find the documentation for 
the expected value.

--
assignee: docs@python
components: Documentation, Extension Modules
messages: 183689
nosy: docs@python, zbysz
priority: normal
severity: normal
status: open
title: initproc return value is unclear
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue17379] Zen amendment

2013-03-07 Thread Brett Cannon

Brett Cannon added the comment:

How about civility beats rudeness. That's clearly delineates it's about your 
discourse with others and eliminates any superiority issues people were feeling 
with the term barbaric.

Obviously Tim would still need to sign off on this as well.

--
nosy: +brett.cannon

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



[issue17379] Zen amendment

2013-03-07 Thread Tim Peters

Tim Peters added the comment:

As I just clarified on the members list, the Zen is about the design of 
Python-the-language.  It's hard to imagine that a programming language _could_ 
be barbaric or rude, Perl notwithstanding ;-)

--

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



[issue17379] Zen amendment

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Actually, INTERCAL mandates a certain amount of politeness (not too little, but 
not too much either): http://en.wikipedia.org/wiki/INTERCAL

--

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



[issue17379] Zen amendment

2013-03-07 Thread Brett Cannon

Brett Cannon added the comment:

Tim has spoken, so closing the bug as rejected.

--
resolution:  - rejected
status: open - closed

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



[issue15605] Explain sphinx documentation building in devguide

2013-03-07 Thread Ezio Melotti

Ezio Melotti added the comment:

 change '2.4 or higher' to '2.4 to 2.7'.

Python 2 should be enough.

 Perhaps we should add These instructions assume that repository/Doc/
 is the current directory. Then we would not have to repeat in multiple 
 places.

There was a somewhat related discussion about this in #16814.

 But even with that correction, making docs will still fail for 3.x.

Maybe we should just updated Sphinx :)  See #10224.

 Perhaps suspicious is available on *nix, just not documented.
 Could someone check?

It is.  See also #15759.

 Then, make an output directory, e.g. under `build/`

On Linux sphinx-build/make html takes care of this already.  Is this not the 
case on Windows?  If not maybe the make.bat should be updated.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Please call it PyDict_SetDefault, though.

--
nosy: +benjamin.peterson

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

I had originally considered that name. However, what it really does is 
PyDict_GetItem(). In a specific special case, it sets a default value and 
*then* returns that. So it's still PyDict_GetItem(), just with a preceding 
modification. Also, the interface mimics PyDict_GetItem(). Its primary 
interface is a getter, not a setter.

I really think that PyDict_SetDefault() is an inappropriate name.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Benjamin Peterson

Benjamin Peterson added the comment:

PyDict_SetDefault mimicks the Python API, though.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

Well, guess what, I kind-of figured that. So, what's wrong with 
PyDict_GetItemSetDefault()? That mimics the Python method name, too, while at 
the same time making it clear what actually happens and how the C-API function 
behaves.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I would simply call it PyDict_SetDefault, too. It's also shorter to type ;)

--
nosy: +pitrou

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

To me, PyDict_SetDefault() sounds like it's supposed to set a default value 
that PyDict_GetItem() would return instead of NULL on lookup failure. Basically 
a defaultdict-like extension to normal dicts.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

I'm fine with PyDict_GetItemOrSetDefault() as well.

--

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



[issue17146] Improve test.support.import_fresh_module()

2013-03-07 Thread Eric Snow

Eric Snow added the comment:

I'm closing this as #17037 offers a better solution and it's unlikely this 
proposal would make it if that one doesn't.

--
resolution:  - wont fix
status: open - closed

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



[issue17369] Message.get_filename produces exception if the RFC2231 encoding is ill-formed

2013-03-07 Thread R. David Murray

R. David Murray added the comment:

Here's a patch.  Note that this fixes a regression relative to Python2, where 
fallback_charset was used in this case.

--
keywords: +patch
versions:  -Python 2.7
Added file: http://bugs.python.org/file29344/collapse_rfc2231_value.patch

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



[issue17369] Message.get_filename produces exception if the RFC2231 encoding is ill-formed

2013-03-07 Thread R. David Murray

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


--
stage: needs patch - patch review

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



[issue17381] IGNORECASE breaks unicode literal range matching

2013-03-07 Thread Chris Adams

New submission from Chris Adams:

I noticed an interesting failure while using re.match / re.sub to look for 
non-Cyrillic characters in allegedly Russian text:

 re.sub(r'[\s\u0400-\u0527]+', ' ', 'Архангельская губерния', 
 flags=re.IGNORECASE)
'Архангельская губерния'
 re.sub(r'[\s\u0400-\u0527]+', '', 'Архангельская губерния', flags=0)
''

The same is true in Python 2.7, although you need to use ur'' patterns for the 
literals to be expanded:

 re.sub(ur'[\s\u0400-\u0527]+', '', u'Архангельская губерния', 
 flags=re.IGNORECASE|regex.UNICODE)
u'\u0410\u0440\u0445\u0430\u043d\u0433\u0435\u043b\u044c\u0441\u043a\u0430\u044f\u0433\u0443\u0431\u0435\u0440\u043d\u0438\u044f'


In contrast, the regex module behaves as expected:

 regex.sub(ur'[\s\u0400-\u0527]+', '', u'Архангельская губерния', 
 flags=regex.IGNORECASE|regex.UNICODE)
u''

(Transcript maintained at https://gist.github.com/acdha/5111687)

--
components: Regular Expressions
messages: 183705
nosy: acdha, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: IGNORECASE breaks unicode literal range matching
type: behavior
versions: Python 2.7, Python 3.3

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



[issue10224] Build 3.x documentation using python3.x

2013-03-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Doc/make.bat assumes that this issue has already been resolved:
  if %PYTHON% EQU  set PYTHON=..\pcbuild\python
Even with '_d' appended, as it should be, that does not work for 3.x.
I think that line should be @rem'ed out until it does work.
Does anyone mind if I do so?

I already suggested on #15605 that a workaround be given until it is no longer 
needed.

--
nosy: +terry.reedy

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



[issue15605] Explain sphinx documentation building in devguide

2013-03-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Python 2 should be enough.
I thought about that. Agreed.

make -C Doc xxx will not work with make.bat. Perhaps 7.6.1. Using make 
should be expanded to 7.6.1 Using make on unix and 7.6.2 Using make on 
Windows added. Then the directory assumption could be put in the latter. But 
see below.

I super agree that all the doc building modules should work on 3.x, or at least 
3.3+, so a freshly built 3.x can build its own docs. But until they do, we need 
to document what works now. I added a note on #10224.

OK, add 'suspicious' to the unix list and the Windows difference is reduced. 
(By the way, suspicious.cvs for 3.4 has 22 lines now.)

I presume that unix make *also* has a 'checkout' target, but it is just not 
mentioned because the other targets list it as a dependency so it gets called 
automatically.

If so, the unix/windows difference would be reduced further if checkout were 
listed in the master list, with a note that explicit 'make checkout' is only 
needed on windows. I think that should be the first target listed, with update 
following. The last two targets that do not work on Windows could have 'Unix 
only'. Then a separate Windows section might not be needed -- though a 
paragraph about setting PYTHON would still be needed until it is not needed.

Yes, make.bat add /build, etc, as needed.
if not exist build mkdir build
if not exist build\%1 mkdir build\%1
if not exist build\doctrees mkdir build\doctrees
(It is really a nice .bat file.)

The line about making /build oneself is in the section about *not* using make. 
Perhaps this section was written before make.bat? Does Mac lack make? If not, 
this section might be recast as explaining what make does.

--

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



[issue14645] Generator does not translate linesep characters in certain circumstances

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 30c0f0dd0b94 by R David Murray in branch '3.2':
#14645: Generator now emits correct linesep for all parts.
http://hg.python.org/cpython/rev/30c0f0dd0b94

New changeset 1b9dc00c4d57 by R David Murray in branch '3.3':
Merge: #14645: Generator now emits correct linesep for all parts.
http://hg.python.org/cpython/rev/1b9dc00c4d57

New changeset 6b69c11b0ad0 by R David Murray in branch 'default':
Merge: #14645: Generator now emits correct linesep for all parts.
http://hg.python.org/cpython/rev/6b69c11b0ad0

--
nosy: +python-dev

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



[issue10224] Build 3.x documentation using python3.x

2013-03-07 Thread Tshepang Lekhonkhobe

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


--
nosy: +tshepang

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



[issue14645] Generator does not translate linesep characters in certain circumstances

2013-03-07 Thread R. David Murray

R. David Murray added the comment:

I'm not going to fix this in Python2.  While the problem exists there, it 
hasn't ever been reported as a bug.  As noted earlier, this is probably 
primarily due to the fact that it would be very exceptional to read an email in 
python2 with anything other than universal newline mode, and Python2 provides 
no way to emit a message with anything other than \n linesep other than 
smtplib.sendmail, which does the \n to \r\n translation.  In Python3, in 
contrast, reading a message as binary is common, and we have 
smtplib.send_message, which writes the message directly using a \r\n linesep 
instead of doing a post-transformation the way smtplib.sendmail does.

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

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for PyDict_SetDefault.  Any other name is confusing.

--

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



[issue17382] debugging with idle: current line not highlighted

2013-03-07 Thread Dirk Zabel

New submission from Dirk Zabel:

When debugging with IDLE with checkbox Source enabled, the source window 
highlights the current line only when the source window is activated. If one of 
the buttons of the IDLE debug window is pressed (Step, Over or Out), the 
source window is no longer active and the highlighting of the current line 
disappears. This makes stepwise execution quite boring.

This effect seems to be os specific. I found it on Windows XP SP3 and Windows 7 
X64 SP1 both with Python 3.2 and Python 3.2.
I tried both Python 3.2 and Python 3.3 on Ubuntu 12.4 LTS, and the problem did 
not show up.
So it seems to be a windows-only problem.

--
components: IDLE
messages: 183711
nosy: dzabel
priority: normal
severity: normal
status: open
title: debugging with idle: current line not highlighted
type: behavior
versions: Python 3.2, Python 3.3

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



[issue17381] IGNORECASE breaks unicode literal range matching

2013-03-07 Thread Matthew Barnett

Matthew Barnett added the comment:

The way the re handles ranges is to convert the two endpoints to lowercase and 
then check whether the lowercase form of the character in the text is in that 
range.

For example, [A-Z] is converted to the range [\x41-\x5A], and the lowercase 
form of 'Q' ('\x51') is 'q' ('\x7A'), which is in the range.

In your example, [\u0400-\u0527] is converted to the range [\u0450-\u0527], but 
the lowercase form of 'А' ('\u0410') is 'а' ('\u0430'), which isn't in the 
range.

This is the same as issue #3511, but a worse failure.

--

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Stefan Behnel

Stefan Behnel added the comment:

Ok (shrug), since everyone seems to agree, PyDict_SetDefault() it is. I 
wouldn't be surprised if the same kind of discussion lead to the original 
naming of dict.setdefault()...

--
Added file: http://bugs.python.org/file29345/pydict_setitemdefault.patch

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



[issue17382] debugging with idle: current line not highlighted

2013-03-07 Thread Dirk Zabel

Dirk Zabel added the comment:

When debugging with IDLE with checkbox Source enabled, the source window 
highlights the current line only when the source window is activated. If one of 
the buttons of the IDLE debug window is pressed (Step, Over or Out), the 
source window is no longer active and the highlighting of the current line 
disappears. This makes stepwise execution quite boring.

This effect seems to be os specific. I found it on Windows XP SP3 and Windows 7 
X64 SP1 both with Python 3.2 and Python 3.3.
I tried both Python 3.2 and Python 3.3 on Ubuntu 12.4 LTS, and the problem did 
not show up.
So it seems to be a windows-only problem.

--

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



[issue17383] Error in documentation /2/tutorial/modules.html#more-on-modules

2013-03-07 Thread Piotr Kuchta

New submission from Piotr Kuchta:

In the 2.7 tutorial, chapter on modules:

 http://docs.python.org/2/tutorial/modules.html#more-on-modules 

I think the last sentence in this paragraph is incorrect:

Modules can import other modules. It is customary but not required to place 
all import statements at the beginning of a module (or script, for that 
matter). The imported module names are placed in the importing module’s global 
symbol table.

This is not true:

 def foo(): import sys
... 
 foo()
 sys.path
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'sys' is not defined

--
assignee: docs@python
components: Documentation
messages: 183715
nosy: Piotr.Kuchta, docs@python
priority: normal
severity: normal
status: open
title: Error in documentation /2/tutorial/modules.html#more-on-modules
versions: Python 2.7

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



[issue17383] Error in documentation /2/tutorial/modules.html#more-on-modules

2013-03-07 Thread Ezio Melotti

Ezio Melotti added the comment:

It should probably say that they are placed in the namespace where they get 
imported, but I'm not sure if the concept of namespace has been covered yet at 
that point of the tutorial.  The sentence probably assume that the modules are 
getting imported at the beginning of the module (as suggested in the previous 
sentence), but even in that case I wouldn't use 'global symbol table'.

--
nosy: +ezio.melotti

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



[issue17383] Error in documentation /2/tutorial/modules.html#more-on-modules

2013-03-07 Thread Ashwini Chaudhary

Changes by Ashwini Chaudhary monty.sin...@gmail.com:


--
nosy: +montysinngh

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-03-07 Thread STINNER Victor

STINNER Victor added the comment:

It looks like PyUnicode_FromUnicode() should accept invalid UTF-16 surrogates 
because the array module indirectly relies on that:

On Windows (16-bit wchar_t/Py_UNICODE), len(array.array('u', '\U0010')) is 
2 and array.array('u', '\U0010')[0] is '\udbff' (lone surrogate).

--

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1fd165883a65 by Victor Stinner in branch '3.3':
Issue #17223: the test is specific to 32-bit wchar_t type
http://hg.python.org/cpython/rev/1fd165883a65

New changeset 42970cbfc982 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #17223: the test is specific to 32-bit wchar_t type
http://hg.python.org/cpython/rev/42970cbfc982

--

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-03-07 Thread STINNER Victor

STINNER Victor added the comment:

The test should now pass on Windows.

--
status: open - closed

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



[issue16321] Move eq.h out of stringlib

2013-03-07 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand why do we have specialized functions to compare strings. 
Can't we reuse PyUnicode_Compare(a, b) or PyUnicode_RichCompare( a, b, Py_EQ)? 
Is unicode_eq() used to inline the code?

By the way, unicode_compare_eq() (subfunction of these functions) and 
unicode_eq() have a different implementation. unicode_eq() checks the first 
byte before calling memcmp(). We should only have one implementation, the 
fastest if possible :-)

See also issue #16286.

--

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



[issue17170] string method lookup is too slow

2013-03-07 Thread STINNER Victor

STINNER Victor added the comment:

 More generally though, this would be improved by precompiling some of the 
 information (like Argument Clinic does, perhaps).

The same idea was already proposed to optimize str%args and str.format(args). 
struct.unpack() does also compile the format into an optimize structure (and 
have a cache).

We may do something like Martin von Loewis's _Py_IDENTIFIER API: compile at 
runtime at the first call, and cache the result in a static variable.

It's not a tiny project, and I don't know exactly how to build a JIT compiler 
for getargs.c, nor how complex it would be. But it would speed up *all* Python 
calls, so any Python application.

--

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread STINNER Victor

STINNER Victor added the comment:

+parser.add_argument('--gz', '--gunzip', '--gzip', '--tgz', '-z', 
+'--ungzip', action = 'store_true', 
+help = 'gz compression')
+parser.add_argument('--bz2', '--bzip2', '--tbz2', '--tbz', '--tb2',
+action = 'store_true', help = 'bz2 compression')
+parser.add_argument('--xz', '--lzma', action = 'store_true',
+help = 'xz compression')

Do we really need so much names for the same option? Where do these names come 
from?

--

main() should exit after extract and create to only do one operation and don't 
always display the usage.

It would be better to not duplicate the list of options and use 
parser.print_help() instead of sys.stdout.write(__doc__).

Some consistency tests on exclusive options (bzip/gzip/lzma and 
list/create/extract) would be nice.

--

tar options on Linux:

   -c, --create
   -t, --list
   -x, --extract, --get
   -z, --gzip, --ungzip
   -j, -I, --bzip
   -C, --directory DIRECTORY

For tarfile, I propose to have a shorter list, and try to stay somehow 
compatible with tar:

   -c, --create
   -t, --list
   -x, --extract
   -z, --gzip
   -j, --bzip
   -C, --directory DIRECTORY

Users of the TAR format usually come from UNIX, so using the same command line 
options should not be so surprising.

I don't like the idea of an optional argument for --extract: --extract file1 
file2 is usually understood/read as --extract=filename archive.tar. If you 
really think that we need to support only extract some files, it should be a 
different option. Linux tar command has no such option. I propose to drop this 
feature (always extract all files).

--
nosy: +haypo

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



[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

2013-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a0b750ea3397 by Benjamin Peterson in branch 'default':
Add PyDict_SetDefault. (closes #17327)
http://hg.python.org/cpython/rev/a0b750ea3397

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Berker Peksag

Berker Peksag added the comment:

New patch(issue13477_v3.diff) attached.

Changes:
* Addressed comments from Serhiy
* Added output parameter to --extract option (from Ankur's patch)
* Updated tests and documentation

The current docstring of tarfile module does not give much
information(it just prints Read from and write to tar format
archives.) so I skipped the -d option.

--
Added file: http://bugs.python.org/file29346/issue13477_v3.diff

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


Removed file: http://bugs.python.org/file29291/issue13477.diff

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


Removed file: http://bugs.python.org/file29346/issue13477_v3.diff

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


Added file: http://bugs.python.org/file29347/issue13477_v3.diff

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



[issue13477] tarfile module should have a command line

2013-03-07 Thread Ankur Ankan

Ankur Ankan added the comment:

 +parser.add_argument('--gz', '--gunzip', '--gzip', '--tgz', '-z', 
 +'--ungzip', action = 'store_true', 
 +help = 'gz compression')
 +parser.add_argument('--bz2', '--bzip2', '--tbz2', '--tbz', '--  tb2',
 +action = 'store_true', help = 'bz2 compression')
 +parser.add_argument('--xz', '--lzma', action = 'store_true',
 +help = 'xz compression')

 Do we really need so much names for the same option? Where do thesenames 
 come from?

   I was trying to implement all the formats mentioned in Serhiy's   
review.  (and also different names for the same format)

--

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



  1   2   >