[issue14053] Make patchcheck work with MQ

2012-02-21 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

Patch looks good; I've just got one more small suggestion.

The variable 'some_applied' in mq_patches_applied isn't really necessary
- it would be clearer if you just said:

return st.returncode == 0 and bstdout

after the call to st.communicate().


> Interesting: I saw that repetition but due “[…] Ideally, it
> should distinguish between this and other errors by checking the
> subprocess's stderr, so that if a different error occurs, we can still
> print out the error message. […]” I just wanted to keep cmd's separated > 
> first :-)

When I said that, I was referring to the 'hg qapplied' command (not the
'hg status' one), but I can see how it might have been confusing ;)

--

___
Python tracker 

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



[issue13866] {urllib, urllib.parse}.urlencode should not use quote_plus

2012-02-21 Thread Michele Orrù

Changes by Michele Orrù :


--
nosy: +maker

___
Python tracker 

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-02-21 Thread Ivan Herman

Changes by Ivan Herman :


--
components: None
nosy: ivan_herman
priority: normal
severity: normal
status: open
title: urlparse on tel: URI-s misses the scheme in some cases
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-02-21 Thread Ivan Herman

New submission from Ivan Herman :

I think that the screen dump below is fairly clear:

10:41 Ivan> python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urlparse
>>> x = "tel:+31-641044153"
>>> urlparse.urlparse(x)
ParseResult(scheme='tel', netloc='', path='+31-641044153', params='', query='', 
fragment='')
>>> y = "tel:+31641044153"
>>> urlparse.urlparse(y)
ParseResult(scheme='', netloc='', path='tel:+31641044153', params='', query='', 
fragment='')
>>> 

It seems that, when the phone number does not have any separator character, the 
parsing goes wrong (separators are not required per RFC 3966)

--

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread STINNER Victor

STINNER Victor  added the comment:

> Question: Should sys.flags.hash_randomization be True (1) when 
> PYTHONHASHSEED=0?  It is now.
>
> Saying yes "working as intended" is fine by me.

It is documented that PYTHONHASHSEED=0 disables the randomization, so
sys.flags.hash_randomization must be False (0).

--

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Gregory P. Smith wrote:
> 
> Gregory P. Smith  added the comment:
> 
> Question: Should sys.flags.hash_randomization be True (1) when 
> PYTHONHASHSEED=0?  It is now.

The flag should probably be removed - simply because
the env var is not a flag, it's a configuration parameter.

Exposing the seed value as sys.hashseed would be better and more useful
to applications.

--

___
Python tracker 

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



[issue14072] urlparse on tel: URI-s misses the scheme in some cases

2012-02-21 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> STINNER Victor  added the comment:
> 
>> Question: Should sys.flags.hash_randomization be True (1) when 
>> PYTHONHASHSEED=0?  It is now.
>>
>> Saying yes "working as intended" is fine by me.
> 
> It is documented that PYTHONHASHSEED=0 disables the randomization, so
> sys.flags.hash_randomization must be False (0).

PYTHONHASHSEED=1 will disable randomization as well :-)

Only setting PYTHONHASHSEED=random actually enables randomization.

--

___
Python tracker 

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




[issue14068] problem with re split

2012-02-21 Thread Ramchandra Apte

Ramchandra Apte  added the comment:

启朗.杨, are you using text.split() in the second case?
text.split() splits on any whitespace character including newlines while 
re.split(text," ") splits on a space.

--
nosy: +ramchandra.apte

___
Python tracker 

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



[issue14068] problem with re split

2012-02-21 Thread harvey yang

harvey yang  added the comment:

i am not use it to split whitespace or newline. i use it to split Chinese full 
stop. and the result is showed at the earlier message.

--

___
Python tracker 

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



[issue14068] problem with re split

2012-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

When you used str split, you had to use a unicode string:
  content.split(u'。')
It's the same with re.split: when I use
  pattern = re.compile('。')
nothing is split, it works much better with:
  pattern = re.compile(u'。')

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Tim McNamara

Changes by Tim McNamara :


--
title: reload(module, ignore_pyc=True) flag -> Idea: Add a flag to reload from 
source, e.g. reload(module, ignore_pyc=True)

___
Python tracker 

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



[issue14034] Add argparse howto

2012-02-21 Thread Steven Bethard

Steven Bethard  added the comment:

I have no objections on adding a howto, and something like the attached patch 
would be fine with me (though I don't have time to review it in full and trust 
you to).

You might want to coordinate with Issue 13850 a bit - they want a quick 
reference table before the first example (which would therefore mean before 
this howto which is replacing the first example).

--

___
Python tracker 

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



[issue14068] problem with re split

2012-02-21 Thread Ramchandra Apte

Ramchandra Apte  added the comment:

The problem is not in re, it is because you are passing '。' to re.split which 
in Python 2.x is actually passed as '\xe3\x80\x82'.
You should pass u'。' to re.compile.
Could we raise a SyntaxError when in a progam a unicode character is in a bytes 
string?
Python 3 does so; it raises "SyntaxError: bytes can only contain ASCII literal 
characters." when you execute b'。'

--

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> That is a good question.  I don't really care either way, but let's
> say +0 for turning it off when seed == 0.

+1

--

___
Python tracker 

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



[issue8033] sqlite: broken long integer handling for arguments to user-defined functions

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e67715b87131 by Petri Lehtinen in branch '3.2':
sqlite3: Fix 64-bit integer handling in user functions on 32-bit architectures
http://hg.python.org/cpython/rev/e67715b87131

New changeset cf12fe9ce2b0 by Petri Lehtinen in branch 'default':
Merge branch '3.2'
http://hg.python.org/cpython/rev/cf12fe9ce2b0

New changeset 789a3ea97083 by Petri Lehtinen in branch '2.7':
sqlite3: Fix 64-bit integer handling in user functions on 32-bit architectures
http://hg.python.org/cpython/rev/789a3ea97083

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

___
Python tracker 

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



[issue14071] allow more than one hash seed per process (move _Py_HashSecret into PyInterpreterState)

2012-02-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +grahamd

___
Python tracker 

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



[issue10181] Problems with Py_buffer management in memoryobject.c (and elsewhere?)

2012-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

Latest version looks good to me - I vote for landing it whenever you're ready :)

--

___
Python tracker 

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



[issue14073] allow per-thread atexit()

2012-02-21 Thread Tarek Ziadé

New submission from Tarek Ziadé :

If you try to run the code below and stop it with ctrl+C, it will lock because 
atexit is never reached.

Antoine proposed to add a way to have one atexit() per thread, so we can call 
some cleanup code when the app shuts down and there are running threads.


{{{
from wsgiref.simple_server import make_server
import threading
import time
import atexit


class Work(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.running = False

def run(self):
self.running = True
while self.running:
time.sleep(.2)

def stop(self):
self.running = False
self.join()

worker = Work()


def shutdown():
# bye-bye
print 'bye bye'
worker.stop()


atexit.register(shutdown)


def hello_world_app(environ, start_response):
status = '200 OK' # HTTP Status
headers = [('Content-type', 'text/plain')]
start_response(status, headers)
return ["Hello World"]

def main():
worker.start()
return make_server('', 8000, hello_world_app)

if __name__ == '__main__':
server = main()
server.serve_forever()
}}}

--
messages: 153871
nosy: tarek
priority: normal
severity: normal
status: open
title: allow per-thread atexit()
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue14073] allow per-thread atexit()

2012-02-21 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--
nosy: +pitrou

___
Python tracker 

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



[issue14073] allow per-thread atexit()

2012-02-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
components: +Interpreter Core, Library (Lib)
nosy: +neologix
type: behavior -> enhancement
versions:  -Python 3.2, Python 3.4

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Feb 21, 2012, at 09:48 AM, Marc-Andre Lemburg wrote:

>Exposing the seed value as sys.hashseed would be better and more useful
>to applications.

That makes the most sense to me.

--

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Feb 21, 2012, at 09:48 AM, Marc-Andre Lemburg wrote:

>The flag should probably be removed - simply because
>the env var is not a flag, it's a configuration parameter.
>
>Exposing the seed value as sys.hashseed would be better and more useful
>to applications.

Okay, after chatting with __ap__ on irc, here's what I think the behavior
should be:

sys.flags.hash_randomization should contain just the value given by the -R
flag.  It should only be True if the flag is present, False otherwise.

sys.hash_seed contains the hash seed, set by virtue of the flag or envar.  It
should contain the *actual* seed value used.  E.g. it might be zero, the
explicitly set integer, or the randomly selected seed value in use during this
Python execution if a random seed was requested.

If you really need the envar value, getenv('PYTHONHASHSEED') is good enough
for that.

--

___
Python tracker 

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



[issue10580] Minor grammar change in Python’s MSI installer

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d9e895d07396 by Martin v. Löwis in branch '2.7':
Issue #10580: Minor grammar change in Windows installer.
http://hg.python.org/cpython/rev/d9e895d07396

--
nosy: +python-dev

___
Python tracker 

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



[issue10580] Minor grammar change in Python’s MSI installer

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset b349c932765a by Martin v. Löwis in branch '3.2':
Issue #10580: Minor grammar change in Windows installer.
http://hg.python.org/cpython/rev/b349c932765a

--

___
Python tracker 

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



[issue10580] Minor grammar change in Python’s MSI installer

2012-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This is now fixed in all relevant branches.

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

___
Python tracker 

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



[issue13703] Hash collision security issue

2012-02-21 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

+1 to what barry and __ap__ discussed and settled on.

--

___
Python tracker 

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



[issue13863] import.c sometimes generates incorrect timestamps on Windows + NTFS

2012-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

For some reason that I'm unable to follow right now, fstat in the crt does this 
dance to obtain st_mtime:
- obtain time stamps using GetFileInformationByHandle
- convert ftLastWriteTime using FileTimeToLocalFileTime to LocalFTime
- convert LocalFTime using FileTimeToSystemTime to SystemTime
- convert SystemTime using __loctotime32_t to st_mtime

Now, SystemTime is broken-down local time, and loctotime32 converts that to 
"UTC" using an explicit formula taking the *current* time zone into account. 
This should work correctly, though, as FileTimeToLocalFileTime also takes into 
account the current time zone.

Anybody analysing this further might want to write a C program that passes 
explicit time values into this procedure (see Vc/crt/src/fstat.c and dtoxtime.c 
for the exact source code), to find out what step exactly goes wrong.

--
nosy: +loewis

___
Python tracker 

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



[issue6807] No such file or directory: 'msisupport.dll' in msi.py

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset bc66484b0d73 by Martin v. Löwis in branch '3.2':
Issue #6807: Run msisupport.mak earlier.
http://hg.python.org/cpython/rev/bc66484b0d73

--
nosy: +python-dev

___
Python tracker 

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



[issue6807] No such file or directory: 'msisupport.dll' in msi.py

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e78acdb54841 by Martin v. Löwis in branch '2.7':
Issue #6807: Run msisupport.mak earlier.
http://hg.python.org/cpython/rev/e78acdb54841

--

___
Python tracker 

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



[issue6807] No such file or directory: 'msisupport.dll' in msi.py

2012-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This is now fixed, though in a different way.

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

___
Python tracker 

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



[issue1521950] shlex.split() does not tokenize like the shell

2012-02-21 Thread Vinay Sajip

Changes by Vinay Sajip :


Added file: http://bugs.python.org/file24590/079ab75d29a4.diff

___
Python tracker 

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



[issue1521950] shlex.split() does not tokenize like the shell

2012-02-21 Thread Vinay Sajip

Vinay Sajip  added the comment:

I updated the patch to reflect Éric's comments on Rietveld, but there are also 
some other changes:

Previously when punctuation chars were set, wordchars was being augmented by 
'-'. This was incomplete, so the augmentation is now with '~-./*?=' which 
allows for wildcards, filename chars and argument flags.

I added a token_type attribute whose value is 'a' for alphanumeric tokens and 
'c' for punctuation tokens. This token type is internally tracked anyway - we 
just expose it now. It is needed for when multiple punctuation tokens need to 
be disambiguated, because we might return two logically separate punctuation 
tokens as one if they are not separated by whitespace in the source being 
tokenised.

New attributes and the changes to wordchars have been documented, and a test 
added for token_type return values.

--

___
Python tracker 

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



[issue1521950] shlex.split() does not tokenize like the shell

2012-02-21 Thread Vinay Sajip

Vinay Sajip  added the comment:

Plus I also changed a few instances of the anachronism

a = a + b

to

a += b

--

___
Python tracker 

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



[issue14074] argparse does not allow nargs>1 for positional arguments but doesn't allow metavar to be a tuple

2012-02-21 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe :

Here's four commands to demonstrate my problem:

My sample code:
$ cat prog.py 
import argparse
parse = argparse.ArgumentParser()
parse.add_argument("foo", nargs=2, metavar=("foo", "bar"))
args = parse.parse_args()
print(args)

This output could be friendlier:
$ python3 prog.py --help
Traceback (most recent call last):
  File "prog.py", line 4, in 
args = parse.parse_args()
  File "/home/wena/cpython/Lib/argparse.py", line 1722, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/home/wena/cpython/Lib/argparse.py", line 1754, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/home/wena/cpython/Lib/argparse.py", line 1960, in _parse_known_args
start_index = consume_optional(start_index)
  File "/home/wena/cpython/Lib/argparse.py", line 1900, in consume_optional
take_action(action, args, option_string)
  File "/home/wena/cpython/Lib/argparse.py", line 1828, in take_action
action(self, namespace, argument_values, option_string)
  File "/home/wena/cpython/Lib/argparse.py", line 1015, in __call__
parser.print_help()
  File "/home/wena/cpython/Lib/argparse.py", line 2347, in print_help
self._print_message(self.format_help(), file)
  File "/home/wena/cpython/Lib/argparse.py", line 2314, in format_help
formatter.add_arguments(action_group._group_actions)
  File "/home/wena/cpython/Lib/argparse.py", line 270, in add_arguments
self.add_argument(action)
  File "/home/wena/cpython/Lib/argparse.py", line 255, in add_argument
invocations = [get_invocation(action)]
  File "/home/wena/cpython/Lib/argparse.py", line 533, in 
_format_action_invocation
metavar, = self._metavar_formatter(action, default)(1)
ValueError: too many values to unpack (expected 1)

On Python 3.2 (from Debian), I get "error: too few arguments". But with latest 
mercurial I get:
$ python3 prog.py
Traceback (most recent call last):
  File "prog.py", line 4, in 
args = parse.parse_args()
  File "/home/wena/cpython/Lib/argparse.py", line 1722, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/home/wena/cpython/Lib/argparse.py", line 1754, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/home/wena/cpython/Lib/argparse.py", line 1973, in _parse_known_args
', '.join(required_actions))
TypeError: sequence item 0: expected str instance, tuple found

But this looks okay:
$ python3 prog.py a b
Namespace(foo=['a', 'b'])

--
components: Library (Lib)
messages: 153884
nosy: tshepang
priority: normal
severity: normal
status: open
title: argparse does not allow nargs>1 for positional arguments but doesn't 
allow metavar to be a tuple
versions: Python 3.3

___
Python tracker 

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



[issue12406] msi.py needs updating for Python 3.3

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 2fed68cf102a by Martin v. Löwis in branch 'default':
Issue #12406: prevent case where shortened name could conflict with short name.
http://hg.python.org/cpython/rev/2fed68cf102a

--

___
Python tracker 

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



[issue14060] Implement a CSP-style channel

2012-02-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

I'd like to veto changing the meaning of 0, it's going to break somebody's 
code. It's easy enough to add some other keyword argument to request an 
unbuffered queue.  Other than that, (1) and (2) seem fine to me.  Please 
consider making these changes for multiprocessing as well.

For (3) I like the idea, but I think we should be more ambitious and instead 
add a way to wait for multiple locks (or other things) across the board, not 
just in the queue module.  (Maybe integrating with I/O waits as well, though 
that feels too ambitious, and is likely to stifle any attempts at a 
cross-platform implementation.)

--

___
Python tracker 

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



[issue8942] __path__ attribute of modules loaded by zipimporter is untested

2012-02-21 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Brett Cannon

Brett Cannon  added the comment:

I don't quite follow what you want. You say you want to *ignore* changes to 
source files, but that's the whole point of a reload. And I don't see how 
ignoring bytecode changes anything unless you are mucking with bytecode formats 
and don't want to have to continuously change the magic number.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Tim McNamara

Tim McNamara  added the comment:

No no, I don't want to ignore source files. I want to be able to change a .py 
file, then reload in the Python shell and for the changes to be applied.

At the moment, .pyc files within a project complicate this.

--

___
Python tracker 

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



[issue14075] argparse: unused method?

2012-02-21 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe :

It appears to me that the function I removed (see attached patch) is unused. 
Since I wasn't sure, I ran the entire test suite, and there wasn't a regression.

--
components: Library (Lib)
files: rm-unused-function.patch
keywords: patch
messages: 153889
nosy: tshepang
priority: normal
severity: normal
status: open
title: argparse: unused method?
versions: Python 3.3
Added file: http://bugs.python.org/file24591/rm-unused-function.patch

___
Python tracker 

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



[issue9098] MSYS build fails with `S_IXGRP' undeclared

2012-02-21 Thread mewalig

mewalig  added the comment:

If I am reading this right, then in the below part of the patch, slave_name 
does not get set before it is used if __MINGW32__ is not defined. this can be 
fixed by moving the "#endif" up to the line before
slave_name = ptsname(master_fd); /* get name of slave */



---

+#if !defined(__MINGW32__)
 sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL);
 /* change permission of slave */
 if (grantpt(master_fd) < 0) {
@@ -4143,10 +4156,15 @@
 slave_name = ptsname(master_fd); /* get name of slave */
 if (slave_name == NULL)
 return posix_error();
+#endif
+#if !defined(__MINGW32__)
 slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */
+#else
+slave_fd = open(slave_name, O_RDWR); /* open slave */
+#endif

--
nosy: +mewalig

___
Python tracker 

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



[issue14067] Avoid more stat() calls in importlib

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> While I don't think the delay in noticing filesystem changes is
> reasonable as the default behaviour, it might be interesting to see how 
> tricky it would be to create a custom importer (for either meta_path or 
> path_hooks) that did this.

Mmmh. Then I think it would be simpler to expose a global option to disable 
freshness checks. That said, it has to be activated as early as possible to be 
effective, which doesn't make it very practical as an opt-in setting.

--

___
Python tracker 

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



[issue14070] Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)

2012-02-21 Thread Brett Cannon

Brett Cannon  added the comment:

Then I'm not understanding the problem as changes to source trump .pyc files in 
a reload(). It should make no difference that .pyc files even exist to a 
reload() as long as source is around.

--
status: open -> pending

___
Python tracker 

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



[issue12406] msi.py needs updating for Python 3.3

2012-02-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 75990a013d4d by Martin v. Löwis in branch 'default':
Issue #12406: Update list of files.
http://hg.python.org/cpython/rev/75990a013d4d

--

___
Python tracker 

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



[issue12406] msi.py needs updating for Python 3.3

2012-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

msi.py is now up-to-date as of 75990a013d4d. If further changes are made to the 
tree that require further changes to msi.py, a new issue should be opened.

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

___
Python tracker 

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



[issue8033] sqlite: broken long integer handling for arguments to user-defined functions

2012-02-21 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

Thanks for the patches, Philippe! I committed the latest one after some 
modifications.

--

___
Python tracker 

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



[issue14075] argparse: unused method?

2012-02-21 Thread Nadeem Vawda

Changes by Nadeem Vawda :


--
nosy: +bethard

___
Python tracker 

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



[issue14076] sqlite3 module ignores placeholers in CREATE TRIGGER code

2012-02-21 Thread GuGu

New submission from GuGu :

When I try to use placeholders in CREATE TRIGGER (for django-denorm module) 
SQLite module just ignores placeholders and sends `None` to it.

For example:

  In [11]: c.cursor().execute('CREATE TRIGGER test1 after insert on a for each 
row begin UPDATE a SET b=?; END', '1').fetchone()

  In [12]: c.cursor().execute('INSERT INTO a values (100)')
  Out[12]: 

  In [13]: c.cursor().execute('SELECT * FROM a').fetchall()
  Out[13]: [(None,), (None,), (None,)]

  In [14]: c.cursor().execute('DROP TRIGGER test1')
  Out[14]: 

  In [15]: c.cursor().execute('CREATE TRIGGER test1 after insert on a for each 
row begin UPDATE a SET b=1; END').fetchone()

  In [16]: c.cursor().execute('INSERT INTO a values (100)')
  Out[16]: 

  In [17]: c.cursor().execute('SELECT * FROM a').fetchall()
  Out[17]: [(u'1',), (u'1',), (u'1',), (u'1',)]

In MySQLdb and psycopg2 creating triggers with a placeholder works.

--
components: Library (Lib)
messages: 153896
nosy: GuGu
priority: normal
severity: normal
status: open
title: sqlite3 module ignores placeholers in CREATE TRIGGER code
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue14075] argparse: unused method?

2012-02-21 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

The _get_args() looks like an obsolete function indeed. However, 
_AttributeHolder is a base class for other classes, so the function was 
probably meant to be overridden by a subclass.

Steven probably knows the best whether it should be kept or not.

--
nosy: +petri.lehtinen

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Just saw this on a buildbot:

==
ERROR: test_rapid_restart 
(test.test_multiprocessing.WithProcessesTestManagerRestart)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/test/test_multiprocessing.py",
 line 1513, in test_rapid_restart
queue = manager.get_queue()
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/multiprocessing/managers.py",
 line 666, in temp
token, exp = self._create(typeid, *args, **kwds)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/multiprocessing/managers.py",
 line 564, in _create
conn = self._Client(self._address, authkey=self._authkey)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/multiprocessing/connection.py",
 line 773, in XmlClient
import xmlrpc.client as xmlrpclib
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 542, in load_module
return self._load_module(fullname)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 220, in module_for_loader_wrapper
return fxn(self, module, *args, **kwargs)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 424, in _load_module
code_object = self.get_code(name)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 529, in get_code
self.set_data(bytecode_path, data)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 597, in set_data
_write_atomic(path, data)
  File 
"/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/importlib/_bootstrap.py",
 line 134, in _write_atomic
fd = _os.open(path_tmp, _os.O_EXCL | _os.O_CREAT | _os.O_WRONLY, 0o666)
FileExistsError: [Errno 17] File exists: 
'/home/buildbot/buildarea/3.x.ochtman-gentoo-amd64/build/Lib/xmlrpc/__pycache__/__init__.cpython-33.pyc.140684930127088'

(http://www.python.org/dev/buildbot/all/builders/AMD64%20Gentoo%20Wide%203.x/builds/3288
 )

--
components: Library (Lib)
messages: 153898
nosy: brett.cannon, neologix, pitrou
priority: normal
severity: normal
status: open
title: sporadic test_multiprocessing failure
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue14006] Improve the documentation of xml.etree.ElementTree

2012-02-21 Thread Leon Matthews

Leon Matthews  added the comment:

The ElementTree.py module has good JavaDoc-style function-level documentation, 
but as it's not in docstring format, it can't be seen from the interactive help.

I'd be willing to convert the current comments into docstrings, as long as I 
wouldn't be stepping on anybody's toes, and somebody could give me some 
guidance as to how to convert the @return and @param declarations, and how to 
handle the C version of the module.  

Any volunteers?

--
nosy: +leonov

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I am proposing the following patch to have a better unique filename:

diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -129,8 +129,8 @@ def _path_absolute(path):
 
 def _write_atomic(path, data):
 """Function to write data to a path atomically."""
-# id() is used to generate a pseudo-random filename.
-path_tmp = '{}.{}'.format(path, id(path))
+# getpid() and id() are used to generate a pseudo-random filename.
+path_tmp = '{}.{}-{}'.format(path, _os.getpid(), id(path))
 fd = _os.open(path_tmp, _os.O_EXCL | _os.O_CREAT | _os.O_WRONLY, 0o666)
 try:
 # We first write data to a temporary file, and then use os.replace() to

--

___
Python tracker 

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



[issue14075] argparse: unused method?

2012-02-21 Thread Geoffrey Spear

Changes by Geoffrey Spear :


--
nosy: +geoffreyspear

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Brett Cannon

Brett Cannon  added the comment:

LGTM

--
stage:  -> commit review

___
Python tracker 

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



[issue14071] allow more than one hash seed per process (move _Py_HashSecret into PyInterpreterState)

2012-02-21 Thread STINNER Victor

STINNER Victor  added the comment:

I'm not sure that it could work because many C functions use caches using 
static variables.

Just a random example:
int
_PyUnicode_HasNULChars(PyObject* s)
{
static PyObject *nul = NULL;

if (nul == NULL)
nul = PyUnicode_FromStringAndSize("\0", 1);
if (nul == NULL)
return -1;
return PyUnicode_Contains(s, nul);
}

If hash(nul) is computed in an interpreter, the same hash value will be used by 
all interpreters. If interpreters use a different hash secret, you will have a 
problem.

--
nosy: +haypo

___
Python tracker 

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



[issue14053] Make patchcheck work with MQ

2012-02-21 Thread Francisco Martín Brugué

Francisco Martín Brugué  added the comment:

Ok! I haven't added NEWS as I thing is easier for the person that applies the 
patch to simply write the line directly there instead of merging. Is that ok? 
let me know if something has to be improved. 

Thanks again for your mentoring this!

--
Added file: http://bugs.python.org/file24592/issue14053_2cceb4d3079a.patch

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Charles-François Natali

Charles-François Natali  added the comment:

> I am proposing the following patch to have a better unique
> filename:

It's unneeded, O_EXCL ensures the file won't be corrupted.
It's actually a regression introduced by de6703671386. My bad.
Here's a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file24593/atomic_exists.diff

___
Python tracker 

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



[issue14073] allow per-thread atexit()

2012-02-21 Thread Graham Dumpleton

Graham Dumpleton  added the comment:

My take on this is that if wanting to interact with a thread from an atexit 
callback, you are supposed to call setDaemon(True) on the thread. This is to 
ensure that on interpreter shutdown it doesn't try and wait on the thread 
completing before getting to atexit callbacks.

--
nosy: +grahamd

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > I am proposing the following patch to have a better unique
> > filename:
> 
> It's unneeded, O_EXCL ensures the file won't be corrupted.
> It's actually a regression introduced by de6703671386. My bad.
> Here's a patch.

But is there still a reason to use id(path) then?

--

___
Python tracker 

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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-02-21 Thread Leon Matthews

New submission from Leon Matthews :

The lxml implementation of the ElementTree API puts a `sourceline` property 
onto every Element object, which I recently found useful when producing 
diagnostic messages.  I think it would be a useful improvement to make the 
standard library's ElementTree implementation.

The attached patch works by copying the current line number from the Expat 
parser into the Element object after the Element object is created (so as to 
minimise its intrusiveness for now).

The patch is just a proof of concept, and although all tests pass, the patch 
currently smells a little hacky and fragile to me.  Hopefully though, it will 
start a discussion with somebody more experienced.

PS. So as not to create a hard dependency on lxml.etree, in my project I worked 
around the issue as follows.  While this works in my case, the standard library 
seems a more logical place for this change::

class XMLParserWithLines(XMLParser):
"""
Add a `sourceline` attribute to element, like lxml.etree
"""
def _start_list(self, *args, **kwargs):
element = super(self.__class__, self)._start_list(*args, **kwargs)
element.sourceline = self._parser.CurrentLineNumber
return element


>>> tree = ElementTree()
>>> tree.parse(path, parser=XMLParserWithLines())
>>> ...

--
components: Library (Lib)
files: elementtree-sourceline.diff
keywords: patch
messages: 153907
nosy: leonov
priority: normal
severity: normal
status: open
title: Add 'sourceline' property to xml.etree Elements
versions: Python 3.3
Added file: http://bugs.python.org/file24594/elementtree-sourceline.diff

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Charles-François Natali

Charles-François Natali  added the comment:

> But is there still a reason to use id(path) then?

IIRC, the reason is to avoid having a stale pyc file indefinitely in
case of crash:
if we always used, let's say, path + '.tmp', if the process crashes
before the rename, then all subsequent attempts to write the bytecode
will fail because of the stale temporary file.

--

___
Python tracker 

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



[issue14075] argparse: unused method?

2012-02-21 Thread Steven Bethard

Steven Bethard  added the comment:

Yeah, the intention was that you could just override _get_args in a subclass to 
get a better __repr__. I think these days all the argparse classes only have 
keyword arguments, so _get_args probably isn't necessary anymore.

--

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> IIRC, the reason is to avoid having a stale pyc file indefinitely in
> case of crash:
> if we always used, let's say, path + '.tmp', if the process crashes
> before the rename, then all subsequent attempts to write the bytecode
> will fail because of the stale temporary file.

But that will also fail if id(path) happens to be fairly
deterministic :) I don't know how much deterministic it can be in
practice, that probably depends on the OS and on the code path?

--

___
Python tracker 

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



[issue14077] sporadic test_multiprocessing failure

2012-02-21 Thread Charles-François Natali

Charles-François Natali  added the comment:

> But that will also fail if id(path) happens to be fairly
> deterministic

Well, if you always get the same id(path), then yes, but I really doubt it, 
especially with CPython where it's the object's address (I guess there's the 
same chance of having varying IDs in other implementations):
"""
$ ./python -c "import io; print(id(io.__file__))"
3073909832
$ ./python -c "import io; print(id(io.__file__))"
3073963080
"""

In case of multiprocessing there was a collision because the import is done 
just after fork(), but the id() will likely change eventually.

If we wanted to be 100% bullet-proof, then we'll need something like 
mkstemp()/NamedTemporaryFile(), which we can't use because of bootstraping 
issues.
Of course, adding the PID won't hurt (except that it's a syscall, and will 
pollute strace's output ;-).

--

___
Python tracker 

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



[issue14079] Problems with recent test_subprocess changes

2012-02-21 Thread Vinay Sajip

New submission from Vinay Sajip :

There appears to be a problem with a recent change made to test_subprocess to 
try and speed it up a bit. The commit with a problem seems to be 834650d63130 
by Ross Lagerwall on 12 Feb 2012, and the problem is in test_poll(), which now 
looks like this:

def test_poll(self):
p = subprocess.Popen([sys.executable, "-c",
  "import os",
  "os.read(1)"], stdin=subprocess.PIPE)
self.addCleanup(p.stdin.close)
self.assertIsNone(p.poll())
os.write(p.stdin.fileno(), b'A')
p.wait()
# Subsequent invocations should just return the returncode
self.assertEqual(p.poll(), 0)

A number of problems here: -c only takes one parameter, so for example

./python -c "import os" "os.read(1)"

never does anything with the "os.read(1)". Possibly

"import os; os.read(1)"

was meant, but that doesn't work either: os.read takes two parameters, fd and 
n, so it seems that what is wanted is

"import os; os.read(0, 1)"

which appears to fulfill the intent to read a byte from stdin.

Because the command being run is effectively

python -c "import os"

the spawned command returns immediately. This (it would appear) leads to a race 
between the test process and the spawned process, such that sometimes the 
poll() returns None and sometimes it returns 0, due to the vagaries of the 
exact circumstances when the test is run. So the test passes on some machines 
but not on others.

It looks like it would be good to change the Popen call to use "import os; 
os.read(0, 1)" as the "-c" parameter value.

--
messages: 153912
nosy: rosslagerwall, vinay.sajip
priority: normal
severity: normal
status: open
title: Problems with recent test_subprocess changes
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue14052] importlib mixes up '.' and os.getcwd()

2012-02-21 Thread Stefan Krah

Stefan Krah  added the comment:

It just happened again on the new FreeBSD-9.0 bot:

http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/1845/steps/test/logs/stdio

==
FAIL: test_package___file__ (test.test_imp.PEP3147Tests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_imp.py", 
line 333, in test_package___file__
os.sep.join(('.', 'pep3147', '__init__.py')))
AssertionError: 'pep3147/__init__.py' != './pep3147/__init__.py'
- pep3147/__init__.py
+ ./pep3147/__init__.py
? ++

--
nosy: +skrah

___
Python tracker 

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



[issue14057] Speedup sysconfig startup

2012-02-21 Thread STINNER Victor

STINNER Victor  added the comment:

Updated patch: continue to simplify the config parser. Using this patch, Python 
startup is ~20% faster on my computer.

Use http://bugs.python.org/file24447/bench_startup.py to measure startup time.

--
Added file: http://bugs.python.org/file24595/sysconfig_parser-2.patch

___
Python tracker 

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



[issue14057] Speedup sysconfig startup

2012-02-21 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file24572/sysconfig_parser.patch

___
Python tracker 

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



[issue13405] Add DTrace probes

2012-02-21 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

Dave, I am in Europe (Spain), and I can't afford (money and time) to go to 
PyCon. If you are going and are interested in pushing this, we can talk about 
our respectives ideas and plans, to present a consensus plan.

--

___
Python tracker 

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



[issue12801] C realpath not used by os.path.realpath

2012-02-21 Thread STINNER Victor

STINNER Victor  added the comment:

realpath.patch:

 - Add os.realpath()
 - posixpath.realpath() uses os.realpath(), or os.getcwd() if the path is an 
empty string
 - os.realpath() uses canonicalize_file_name() if available, or use realpath() 
with a buffer of MAXPATHLEN bytes

Don't use realpath(path, NULL) because it is not possible to test if realpath() 
supports NULL: OpenBSD did segfault if the buffer was NULL. Testing the support 
in configure is not a good idea because it depends on the version of the C 
library. You may use a more recent C library to compile Python for example.

genericpath, macpath and os2emxpath are not patched to use os.realpath(), even 
if it is available. I don't know if these modules should be patched. ntpath 
uses the native Windows function (if available): GetFullPathNameW().

--
Added file: http://bugs.python.org/file24596/realpath.path

___
Python tracker 

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



[issue14080] Sporadic test_imp failure

2012-02-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/1845/steps/test/logs/stdio

==
FAIL: test_package___file__ (test.test_imp.PEP3147Tests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_imp.py", 
line 333, in test_package___file__
os.sep.join(('.', 'pep3147', '__init__.py')))
AssertionError: 'pep3147/__init__.py' != './pep3147/__init__.py'
- pep3147/__init__.py
+ ./pep3147/__init__.py
? ++

--
components: Library (Lib), Tests
messages: 153917
nosy: brett.cannon, ncoghlan, pitrou, skrah
priority: normal
severity: normal
status: open
title: Sporadic test_imp failure
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue14080] Sporadic test_imp failure

2012-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Updated build URL (the buildbot changed name):
http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/1845/steps/test/logs/stdio

--

___
Python tracker 

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



[issue14068] problem with re split

2012-02-21 Thread harvey yang

harvey yang  added the comment:

i see. thanks :)

--

___
Python tracker 

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



[issue14081] Allow "maxsplit" argument to str.split() to be passed as a keyword argument

2012-02-21 Thread Nick Coghlan

New submission from Nick Coghlan :

Currently, setting maxsplit for the default "any whitespace" behaviour requires 
the following cryptic incantation:

'do re mi fa'.split(None, 1)

That would be significantly more comprehensible as:

'do re mi fa'.split(maxsplit=1)

(I noticed this when trying to figure out why 
http://hyperpolyglot.org/scripting#split-notes resorted to using the re module 
to achieve this)

--
components: Interpreter Core
messages: 153920
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Allow "maxsplit" argument to str.split() to be passed as a keyword 
argument
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue14068] problem with re split

2012-02-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

As long as you don't mix str and unicode everything works.

With strings:
>>> s = '与清新。阿德莱'
>>> re.split('。', s)
['\xe4\xb8\x8e\xe6\xb8\x85\xe6\x96\xb0', '\xe9\x98\xbf\xe5\xbe\xb7\xe8\x8e\xb1']
>>> s.split('。')
['\xe4\xb8\x8e\xe6\xb8\x85\xe6\x96\xb0', '\xe9\x98\xbf\xe5\xbe\xb7\xe8\x8e\xb1']

With unicode:
>>> u = u'与清新。阿德莱'
>>> re.split(u'。', u)
[u'\u4e0e\u6e05\u65b0', u'\u963f\u5fb7\u83b1']
>>> u.split(u'。')
[u'\u4e0e\u6e05\u65b0', u'\u963f\u5fb7\u83b1']

Mixing str and unicode:
>>> re.split(u'。', s)
['\xe4\xb8\x8e\xe6\xb8\x85\xe6\x96\xb0\xe3\x80\x82\xe9\x98\xbf\xe5\xbe\xb7\xe8\x8e\xb1']
>>> re.split('。', u)
[u'\u4e0e\u6e05\u65b0\u3002\u963f\u5fb7\u83b1']
>>>
>>> s.split(u'。')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal 
not in range(128)
>>> u.split('。')
Traceback (most recent call last):
  File "", line 1, in 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal 
not in range(128)


The syntax error is raised for byte literals and can't be backported to 2.7.  
Raising an error when str and unicode are mixed in re is not backward 
compatible, and re does work as long as both are ASCII only.  I'm therefore 
closing this as invalid.

--
nosy: +mrabarnett
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue5411] Add xz support to shutil

2012-02-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +hynek

___
Python tracker 

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



[issue14082] shutil doesn't support extended attributes

2012-02-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

shutil doesn't provide any function which copies extended attributes on files. 
Note that "cp -a" does copy xattrs, but "cp -p" doesn't (and copy2() claims to 
work like "cp -p").

--
components: Library (Lib)
messages: 153922
nosy: benjamin.peterson, hynek, neologix, pitrou
priority: low
severity: normal
status: open
title: shutil doesn't support extended attributes
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue14083] Use local timezone offset by default in datetime.timezone

2012-02-21 Thread Nick Coghlan

New submission from Nick Coghlan :

Currently, datetime.timezone requires that the offset be specified explicitly.

It would be more convenient if the local offset was used by default.

Since the time module already exposes the offset details for the local 
timezone, this would just make:

  local_tz = datetime.timezone()

equivalent to the current complex incantation:

  local_tz = datetime.timezone(datetime.timedelta(hours=(time.timezone / -3600 
+ tm.tm_isdst)))

Then getting a timezone aware version of the local time would just be:

  now = datetime.datetime.now(datetime.timezone())

Similar to the existing spelling for UTC:

  now = datetime.datetime.now(datetime.timezone.utc)

(Inspired by http://hyperpolyglot.org/scripting#timezone-offset-notes)

--
components: Library (Lib)
messages: 153923
nosy: belopolsky, lemburg, ncoghlan, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Use local timezone offset by default in datetime.timezone
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue14081] Allow "maxsplit" argument to str.split() to be passed as a keyword argument

2012-02-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

+1
Patch attached.

--
assignee:  -> ezio.melotti
keywords: +patch
nosy: +ezio.melotti
stage: needs patch -> commit review
Added file: http://bugs.python.org/file24597/issue14081.diff

___
Python tracker 

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



[issue14083] Use local timezone offset by default in datetime.timezone

2012-02-21 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

The problem with this idea is that while evaluating 
datetime.datetime.now(datetime.timezone()), python will have to query the real 
time clock twice (first in timezone() and then in now()).  At a particularly 
unfortunate time this may result in an error.  Unlikely? Yes, but I would not 
board a python powered airplane if this problem was in the standard library.

I gave a lot of thought to the problem of supporting timezone aware local time 
and issue9527 was the best solution I was able to come up with.

--

___
Python tracker 

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



[issue14079] Problems with recent test_subprocess changes

2012-02-21 Thread Ross Lagerwall

Ross Lagerwall  added the comment:

This was hopefully fixed in e5a94b56d6bc.

Was it one of the buildbots that was failing?

--

___
Python tracker 

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



[issue14083] Use local timezone offset by default in datetime.timezone

2012-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

Marking as a duplicate of #9527.

If that API is added, the local fixed offset timezone will be accessible as 
datetime.datetime.localtime().tzinfo which would be simple enough.

--
resolution:  -> duplicate
superseder:  -> Add aware local time support to datetime module

___
Python tracker 

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



[issue14083] Use local timezone offset by default in datetime.timezone

2012-02-21 Thread Nick Coghlan

Changes by Nick Coghlan :


--
status: open -> closed

___
Python tracker 

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



[issue9527] Add aware local time support to datetime module

2012-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

One important thing to remember is that once a time is in the past, whether or 
not DST was in effect for that time *is never going to change*. That means 
converting a DST aware timezone to a fixed offset timezone will work just fine 
for historical times.

It's mainly applications that need to handle times in the *future* (where the 
DST dates are still subject to change) that have to be aware of the problems 
when trying to handle DST with fixed offset timezone objects.

I think it's sufficient if the documentation pushes developers of such 
applications towards modules like pytz and dateutil to get access to variable 
offset tzinfo implementations.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue13405] Add DTrace probes

2012-02-21 Thread Marc Abramowitz

Marc Abramowitz  added the comment:

Jesús said he was focusing on Solaris and couldn't help with OS X. Not sure if 
anyone else was going to try tackling that...

Just tried the patch `issue13405_4027.diff` on OS X 10.6.8.

First problem I ran into was:

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
-I. -I./Include-DPy_BUILD_CORE -o ./Include/phelper_offsets \
./Include/phelper_offsets.c
./Include/phelper_offsets.c: In function 'main':
./Include/phelper_offsets.c:23: warning: format '%d' expects type 'int', but 
argument 2 has type 'long int'
./Include/phelper_offsets.c:26: warning: format '%d' expects type 'int', but 
argument 2 has type 'long unsigned int'
./Include/phelper_offsets.c:28: warning: implicit declaration of function 
'offsetof'
./Include/phelper_offsets.c:28: error: expected expression before 
'PyCompactUnicodeObject'
./Include/phelper_offsets.c:30: error: expected expression before 
'PyCompactUnicodeObject'
make: *** [Include/phelper_offsets.h] Error 1

OS X seems to have `offsetof` defined in `stddef.h` -- adding `#include 
` got this to compile.

The next problem was with: 

```
if test "dtrace" != "" ; then \
dtrace -o Python/phelper.o -DPHELPER -64 \
-I. -I./Include   -C -G -s ./Include/phelper.d ; \
elsetouch Python/phelper.o ; \
fi;
```

This fails because DTrace on OS X doesn't have the -G option. Removing the `-G` 
(total hack since it seems like `-G` is not at all a trivial option) results in:

```
dtrace: failed to initialize dtrace: DTrace requires additional privileges
```

Adding `sudo` isn't a practical solution, but I tried it to see if it would 
help or if there would be other errors and there was another error:

```
dtrace: ignored option -- 64
/dev/fd/5:42:8: warning: undefining "__STDC__"
dtrace: failed to compile script ./Include/phelper.d: 
"/usr/include/libkern/_OSByteOrder.h", line 98: specified storage class not 
appropriate in D
make: *** [Python/phelper.o] Error 1
```

--
nosy: +Marc.Abramowitz

___
Python tracker 

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