[issue19807] calculation of standard math returns incorrect value

2013-11-27 Thread Mark Dickinson

Mark Dickinson added the comment:

Sorry; this is just the way that (binary) floating-point works.  See 
http://docs.python.org/2/tutorial/floatingpoint.html for more (or Google 
'binary floating point' for a host of references).

If you're doing financial calculations, you may want to look into the decimal 
module: http://docs.python.org/2/library/decimal.html

--
nosy: +mark.dickinson
resolution:  - invalid
status: open - closed

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



[issue19807] calculation of standard math returns incorrect value

2013-11-27 Thread chili

chili added the comment:

Thx for help.

--

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



[issue19772] str serialization of Message object may mutate the payload and CTE.

2013-11-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I come out with two patches.

The first patch using bytes generator to copy the message before mutating it in 
string generator, then restore it after printing the mutated message.

--
keywords: +patch
Added file: 
http://bugs.python.org/file32865/fix_serialization_message_object_mutation_v1.patch

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



[issue19772] str serialization of Message object may mutate the payload and CTE.

2013-11-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

The second patch copies the private variables of the message before mutating it 
in string generator, then restore the private variables after printing the 
mutated message.

--
Added file: 
http://bugs.python.org/file32866/fix_serialization_message_object_mutation_v2.patch

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



[issue19808] IDLE applys syntax highlighting to user input in its shell

2013-11-27 Thread Peter Otten

New submission from Peter Otten:

For example when you type

 input(What shall I do? )
Run for your life!

in its shell window IDLE shows the 'for' as if it were a keyword. The same 
happens if you run a script that requires user interaction.

--
components: IDLE
messages: 204566
nosy: peter.otten
priority: normal
severity: normal
status: open
title: IDLE applys syntax highlighting to user input in its shell

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



[issue19808] IDLE applies syntax highlighting to user input in its shell

2013-11-27 Thread Peter Otten

Changes by Peter Otten __pete...@web.de:


--
title: IDLE applys syntax highlighting to user input in its shell - IDLE 
applies syntax highlighting to user input in its shell

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



[issue19772] str serialization of Message object may mutate the payload and CTE.

2013-11-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I got another inspiration.

The third patch uses copy.copy to copy the Message before mutating it in string 
generator, then restore it after printing the mutated message.

--
Added file: 
http://bugs.python.org/file32867/fix_serialization_message_object_mutation_v3.patch

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



[issue2226] Small _abcoll Bugs / Oddities

2013-11-27 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue8743] set() operators don't work with collections.Set instances

2013-11-27 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue19809] Python get stuck in second Popen call

2013-11-27 Thread Owen Lin

New submission from Owen Lin:

If we call two subprocess.Popen simultaneously, the second one is blocked until 
the first one is finished. 

The attached file is a code snippet to reproduce this bug. I can reproduce the 
bug in version 2.7.3 and 2.7.6 very easily (in few seconds with the code). But 
it works fine on python3. 


Here is the backtrace of python
==
#0  0x7f0eba954d2d in read () at ../sysdeps/unix/syscall-template.S:82#1  
0x005d8d10 in posix_read (self=0x0, args=(5, 1048576)) at 
../Modules/posixmodule.c:6628#2  0x00486896 in PyCFunction_Call 
(func=built-in function read, arg=(5, 1048576), kw=0x0)at 
../Objects/methodobject.c:81#3  0x005278e4 in ext_do_call 
(func=built-in function read, pp_stack=0x7fff1fc0ac80, flags=1, na=0, nk=0)   
 at ../Python/ceval.c:4331
#4  0x005215cd in PyEval_EvalFrameEx (
f=Frame 0x298f800, for file /usr/lib/python2.7/subprocess.py, line 478, in 
_eintr_retry_call (func=built-in funct
ion read, args=(5, 1048576)), throwflag=0) at ../Python/ceval.c:2705
#5  0x00523c2e in PyEval_EvalCodeEx (co=0x294b880, 
globals={'STDOUT': -2, '_has_poll': True, 'gc': module at remote 0x29672d0, 
'check_call': function at remote 0x29c4450, 'mswindows': False, 'select': 
module at remote 0x29676e0, 'list2cmdline': function at remote 0x29c45a0, 
'__all__': ['Popen', 'PIPE', 'STDOUT', 'call', 'check_call', 'check_output', 
'CalledProcessError'], 'errno': module at remote 0x272d4d8, '_demo_posix': 
function at remote 0x29c4648, '__package__': None, 'PIPE': -1, '_cleanup': 
func
===

The fd 5 is actually a pipe. But I cannot find the other end of the pipe. A 
workaround is using lock around all the Popen()s.

--
files: test.py
messages: 204568
nosy: owenlin
priority: normal
severity: normal
status: open
title: Python get stuck in second Popen call
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file32868/test.py

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



[issue19810] adding an feature to python interpreter

2013-11-27 Thread madan ram

New submission from madan ram:

I found that it will be useful to show the list of function arguments using 
inspect module. When the function executed by the user in interpreter as 
TypeError. 

ex: - 

def foo(a,b=4,c=hello):
... print a,b,c

foo()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() takes at least 2 arguments (0 given)

Rather the displaying like above it is will be much more readable to show as 
below.

foo()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() takes at least 1 arguments args=['a', 'b', 'c'], varargs=None, 
keywords=None, defaults=(4, 'hello') (0 given)

This will be advantageous when the user has forgotten what parameter to use for 
builtin function when working offline.

--
components: Interpreter Core
messages: 204569
nosy: eric.araujo, ezio.melotti, georg.brandl, gpolo, madan.ram
priority: normal
severity: normal
status: open
title: adding an feature to python interpreter
versions: Python 3.3, Python 3.4, Python 3.5

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



[issue19810] Adding a feature to python interpreter

2013-11-27 Thread madan ram

Changes by madan ram madan_...@rocketmail.com:


--
title: adding an feature to python interpreter - Adding a feature to python 
interpreter

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



[issue19809] Python get stuck in second Popen call

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

The creation of slave_popen is not protected by a lock, and so dummy_thread() 
may spawn a new process (master) at the same time than the main process 
(slave). If it occurs at the same time, the master may inherit a pipe of the 
slave process used internally by the subprocess module to send the exception to 
the parent process if a Python exception occurs in the child process.

The inheritance of pipes has been partially fixed in Python 3.2 with the new 
function _posixsubprocess.cloexec_pipe() which uses pipe2() function to 
atomically create a pipe with the O_CLOEXEC flag set.

The problem has been fixed complelty in Python 3.4 with the PEP 446: all files 
are now created non inheritable by default, and atomic functions to set the 
non inheritable flag are used when available.

You posted a Python 2.7 script, so I suppose that you are stuck at Python 2. In 
this case, you can workaround the issue by using a lock around the creation of 
any subprocess. To fix your example, just surround slave_popen creation with 
with lock: ... or lock.acquire()/lock.release(), as you did for master_popen.

I propose to convert this issue to a documentation issue: we should add a 
warning explaining that spawning processes in more than one thread can lead to 
such race condition and hang one or more threads. And suggest to use a lock to 
workaround such issue.

See also the atfork proposition which includes such lock:
http://bugs.python.org/issue16500

--

Your script has other issues:

- you should pass a file open in write mode for stdout/stderr
- you should close open(os.devnull) files, or open them outside the loop
- you should join the thread, or use a daemon thread. If you don't join 
threads, you will quickly read the limit of the number of threads
- you can use shell=True to avoid spawning two process to run sleep (or simply 
use time.sleep :-))
- you need a synchronization between the two threads to ensure that 
master_popen is created before trying to kill it

--
nosy: +haypo, neologix, sbt

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



[issue19810] Adding a feature to python interpreter

2013-11-27 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
nosy:  -georg.brandl
versions:  -Python 3.3, Python 3.4

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



[issue19809] Doc: subprocess should warn uses on race conditions when multiple threads spawn child processes

2013-11-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python
title: Python get stuck in second Popen call - Doc: subprocess should warn 
uses on race conditions when multiple threads spawn child processes

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



[issue19811] test_pathlib: The directory is not empty error on os.rmdir()

2013-11-27 Thread STINNER Victor

New submission from STINNER Victor:

test_pathlib should use test.support.rmtree() instead of shutil.rmtree(). The 
function in support tries harder on Windows.

test_pathlib may also create an unique temporary directory at each test run 
instead of using a global variable BASE: see below, tests are failing because 
the directory already exist. (Well, this issue is a consequence of the first 
one.)

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/3476/steps/test/logs/stdio

==
ERROR: test_touch_common (test.test_pathlib.WindowsPathTest)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 477, 
in rmtree
return _rmtree_unsafe(path, onerror)
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 367, 
in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 367, 
in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 376, 
in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 374, 
in _rmtree_unsafe
os.rmdir(path)
OSError: [WinError 145] The directory is not empty: 
'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp\\dirC\\dirD'

==
ERROR: test_touch_nochange (test.test_pathlib.WindowsPathTest)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py, 
line 1081, in setUp
os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: 
'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

==
ERROR: test_unlink (test.test_pathlib.WindowsPathTest)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py, 
line 1081, in setUp
os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: 
'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

==
ERROR: test_with (test.test_pathlib.WindowsPathTest)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_pathlib.py, 
line 1081, in setUp
os.mkdir(BASE)
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: 
'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_4528\\@test_4528_tmp'

--

--
components: Windows
messages: 204571
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: test_pathlib: The directory is not empty error on os.rmdir()
versions: Python 3.4

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



[issue19803] memoryview complain ctypes byte array are not native single character

2013-11-27 Thread Stefan Krah

Stefan Krah added the comment:

Memoryview currently only knows the types from the struct module.

--
nosy: +skrah

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



[issue19812] reload() by symbol name

2013-11-27 Thread anatoly techtonik

New submission from anatoly techtonik:

It would be nice if reload() supported reloading of symbols imported with from 
module import ... syntax. It is quite useful for development sessions, when 
you patch and test your function on some set of unexpected input.

 from astdump import dumpattrs as dat
 import imp
 imp.reload(dat)
TypeError: reload() argument must be module
 imp.reload(dumpattrs)
NameError: name 'dumpattrs' is not defined
 imp.reload(astdump)
NameError: name 'astdump' is not defined


--
components: Interpreter Core, Library (Lib)
messages: 204573
nosy: techtonik
priority: normal
severity: normal
status: open
title: reload() by symbol name
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5

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



[issue19812] reload() by symbol name

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

You can retrieve the module using sys.modules[symbol.__module__].

Example:

 from os import environ as ENV
 import imp, sys
 imp.reload(sys.modules[ENV.__module__])
module 'os' from '/usr/lib64/python2.7/os.pyc'
 _.environ is ENV
False

But if you import symbols instead of modules, symbols will still point to the 
old version of the module. This explain the final False result.

You should import modules if you want to play with reload().

I prefer to exit and restart Python instead of playing with reload, I see it as 
a hack which has many issues like _.environ is ENV returning False.

--
nosy: +haypo

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-27 Thread STINNER Victor

New submission from STINNER Victor:

Since Linux 2.6.28, socket() syscall accepts a new SOCK_NONBLOCK flag in the 
socket type. It avoids 1 or 2 extra syscalls to set the socket in non-blocking 
mode. This flag comes also slowly in other operating systems: NetBSD, FreeBSD, 
etc.

FreeBSD:
http://lists.freebsd.org/pipermail/freebsd-hackers/2013-March/042242.html

Discussion in the POSIX standard:
http://austingroupbugs.net/view.php?id=411

Avoiding the syscalls has been proposed on python-dev a few months ago:
https://mail.python.org/pipermail/python-dev/2013-January/123661.html

I tried to include SOCK_NONBLOCK in my PEP 446, but I have been asked to treat 
it separatly because it's completly different than O_CLOEXEC (even it looks 
similar).
http://hg.python.org/peps/file/fa873d5aed27/pep-0446.txt#l64

I also proposed to add 2 functions in the PEP:

* ``os.get_blocking(fd:int) - bool``
* ``os.set_blocking(fd:int, blocking: bool)``

I propose to add a new timeout parameter to socket.socket() constructor which 
would set the timeout internal attribute and set O_NONBLOCK flag using the new 
SOCK_NONBLOCK flag, ioctl() or fcntl() (depending on the OS and on what is 
available).

I don't know if something special should be done on Windows for non-blocking 
sockets? socket.socket.setblocking() already exists and I suppose that it works 
on Windows :-) See also the discussion in my old PEP for non-blocking 
operations in files on Windows:
http://hg.python.org/peps/file/fa873d5aed27/pep-0446.txt#l177

I don't know if the new parameter can just be added at the end of the parameter 
list, or it should be a keyword-only parameter to avoid breakpoint backward 
compatibility?

socket.socketpair() and socket.socket.dup() and socket.fromfd(), 
socket.create_connection() (and more generally any function creating a new 
socket) may also be modified.

--

By the way, internal_setblocking() currently uses 2 fcntl() syscalls on Linux, 
whereas it could be implemented with a single ioctl() syscall using FIONBIO.

Set O_NONBLOCK flag:

int flag = 1;
ioctl(fd, FIONBIO, flag);

Clear O_NONBLOCK flag:

int flag = 0;
ioctl(fd, FIONBIO, flag);

Tell me if you prefer a different issue for this optimization.

--
messages: 204575
nosy: gvanrossum, haypo, pitrou
priority: normal
severity: normal
status: open
title: Add a new optional timeout parameter to socket.socket() constructor
type: enhancement
versions: Python 3.5

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Note: Python supports socket.SOCK_NONBLOCK since Python 3.2 (issue #7523).

--
nosy: +neologix

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



[issue19806] smtpd crashes when a multi-byte UTF-8 sequence is split between consecutive data packets

2013-11-27 Thread Illirgway

Illirgway added the comment:

base64, quoted-printable and 7bit messages only use ASCII range of 
characters so raw_message.decode('ascii') == raw_message.decode('latin1') == 
etc. == raw_message.decode('utf-8') due to internal representation of utf-8 
characters

P.S. Python 3.4.0 beta 1 Lib/smtpd has the same bug and needs the same patch to 
fix this issue

--
nosy: +Illirgway
versions: +Python 3.4

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



[issue19806] smtpd crashes when a multi-byte UTF-8 sequence is split between consecutive data packets

2013-11-27 Thread R. David Murray

R. David Murray added the comment:

It occurs to me to wonder why smtpd is receiving 8bit data at all.  It isn't 
advertising the 8BITMIME capability, so the client should be sending only 7bit 
data.  See also issue 19662.  I'm not sure that making utf-8 decoding work 
better is a good idea, but I suppose that since it is a data-dependent 
exception in a situation that would work with different data, we should go 
ahead and fix it.

--
nosy: +r.david.murray

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



[issue19813] Add a new optional timeout parameter to socket.socket() constructor

2013-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This really sounds pointless to me. How many sockets do you create per second?

--

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



[issue19806] smtpd crashes when a multi-byte UTF-8 sequence is split between consecutive data packets

2013-11-27 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Is there a reason why this patch changes the decoding error handler to 'ignore' 
(from the default 'strict')?

--

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



[issue19811] test_pathlib: The directory is not empty error on os.rmdir()

2013-11-27 Thread Antoine Pitrou

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


--
resolution:  - duplicate
status: open - closed
superseder:  - support.rmtree fails on symlinks under Windows

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



[issue19802] socket.SO_PRIORITY is missing

2013-11-27 Thread Antoine Pitrou

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


--
nosy: +haypo

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Eli Bendersky

Eli Bendersky added the comment:

Attaching a new patch. Hopefully the image will be viewable in the code review 
tool

--
Added file: http://bugs.python.org/file32869/issue19799.2.patch

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Hopefully the image will be viewable in the code review tool

Apparently not :)

--

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Eli Bendersky

Eli Bendersky added the comment:

Just in case it isn't: 
https://dl.dropboxusercontent.com/u/15602400/images/pathlib-inheritance.png

--

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-27 Thread Eli Bendersky

New submission from Eli Bendersky:

Prefix matching behavior can lead to bugs when combined with parse_known_args. 
See this thread for more details:

https://mail.python.org/pipermail/python-dev/2013-November/130601.html

Issue #14910 deals with making it optional, but until 3.5 we'll have to do with 
a documentation warning.

--
assignee: eli.bendersky
components: Documentation
messages: 204584
nosy: bethard, eli.bendersky, r.david.murray
priority: high
severity: normal
status: open
title: Document prefix matching behavior of argparse, particularly for 
parse_known_args
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue19806] smtpd crashes when a multi-byte UTF-8 sequence is split between consecutive data packets

2013-11-27 Thread Illirgway

Illirgway added the comment:

because strict throws an exception (for example, on raw win1251) which brings 
down production smtp daemon and replace embeds ugly characters into 
received (and passed) email messages

--

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



[issue19802] socket.SO_PRIORITY is missing

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

You should also modify Doc/library/socket.rst to mention the new constant in 
the documentation (don't forget the .. versionadded:: flag).

Adding a new constant cannot break anything in Python, so I propose to it in 
Python 3.4.

@Larry (our release manager): Do you agree?

--
nosy: +larry

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



[issue19629] support.rmtree fails on symlinks under Windows

2013-11-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Could you please attach the picture separatly?

--
nosy: +haypo

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



[issue19810] Display function signature in TypeErrors resulting from argument mismatches

2013-11-27 Thread R. David Murray

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


--
title: Adding a feature to python interpreter - Display function signature in 
TypeErrors resulting from argument mismatches
type:  - enhancement

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



[issue19810] Adding a feature to python interpreter

2013-11-27 Thread R. David Murray

R. David Murray added the comment:

That's much less readable than the output from pfydoc, which the user can 
access easily (via either help at the interpreter prompt or pydoc at the shell 
prompt).  So I'm -1 on this proposed change.

--
nosy: +r.david.murray

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



[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-27 Thread Eli Bendersky

Eli Bendersky added the comment:

Here's a patch for 3.3; if it looks ok i'll merge it to default and also to 2.7

--
keywords: +patch
Added file: http://bugs.python.org/file32870/issue19814.doc33.patch

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Eli Bendersky

Eli Bendersky added the comment:

On Wed, Nov 27, 2013 at 6:21 AM, STINNER Victor rep...@bugs.python.orgwrote:


 STINNER Victor added the comment:

 Could you please attach the picture separatly?


Done

--

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Eli Bendersky

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


Added file: http://bugs.python.org/file32871/pathlib-inheritance.png

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Which tool did you use to draw this schema? You may attach also the source if 
someone would like to modify it in the future.

--

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread Eli Bendersky

Eli Bendersky added the comment:


 STINNER Victor added the comment:

 Which tool did you use to draw this schema? You may attach also the source
 if someone would like to modify it in the future.


Sorry, but there's no source. I drew it graphically. But since I did it
with Google Drive's drawing program, I can just share out a link to the
editor -
https://docs.google.com/drawings/d/1F8do-1WL1sIGkZuiufcxcpZRtS0w4SwAowq-Uamrwt8/edit?usp=sharing

I suppose if someone wants to edit it they can copy the document and do
that.

--

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



[issue19802] socket.SO_PRIORITY is missing

2013-11-27 Thread Larry Hastings

Larry Hastings added the comment:

It's *possible* but I'm willing to risk it.  You have my permission to apply 
that patch.

--

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



[issue14910] argparse: disable abbreviation

2013-11-27 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

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



[issue19810] Display function signature in TypeErrors resulting from argument mismatches

2013-11-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

While we don't print the whole signature, this is much improved in 3.3:

 def foo(a,b=4,c=hello): pass
 foo()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() missing 1 required positional argument: 'a'

--
nosy: +benjamin.peterson
resolution:  - rejected
status: open - closed

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



[issue19799] Clarifications for the documentation of pathlib

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

You can export the schema as SVG.

--

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



[issue19792] pathlib does not support symlink in Windows XP

2013-11-27 Thread Brian Curtin

Brian Curtin added the comment:

If a platform does not actually support symlinks, and XP does not actually 
support symlinks for any usual definition of an operating system supporting a 
feature, then I'm not sure why pathlib is doing something wrong to make it work 
more reasonably in that case.

os.symlink is a NotImplementedError on Windows versions prior to Vista 
because the Windows API doesn't support CreateSymbolicLink. It doesn't make 
sense to just let the code try to run for all versions on all platforms but be 
wrapped in a try/catch block for the NotImplementedError.

--

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



[issue19802] socket.SO_PRIORITY is missing

2013-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bbada125b3f by Benjamin Peterson in branch 'default':
add SO_PRIORITY (closes #19802)
http://hg.python.org/cpython/rev/9bbada125b3f

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

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



[issue19780] Pickle 4 frame headers optimization

2013-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

If you want a slow file object, you could benchmark with a GzipFile or similar.

--

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



[issue19792] pathlib does not support symlink in Windows XP

2013-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The 2.7-compatible version of pathlib explains why the code is structured this 
way:

if sys.getwindowsversion()[:2] = (6, 0) and sys.version_info = (3, 2):
from nt import _getfinalpathname
else:
supports_symlinks = False
_getfinalpathname = None


In the stdlib version, I removed the `sys.version_info = (3, 2)` and so it may 
look like as easy to rely on os.symlink raising NotImplementedError. That would 
make merging back more difficult, though, so I'd rather keep it like that.

--

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



[issue19781] No SSL match_hostname() in ftplib

2013-11-27 Thread Antoine Pitrou

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


--
nosy: +giampaolo.rodola

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



[issue19812] reload() by symbol name

2013-11-27 Thread Brett Cannon

Brett Cannon added the comment:

As Victor pointed out, this is not really feasible at the object level. You can 
work your way back up to reload a whole module, but it won't update the object 
you passed in, which is just going to confuse users.

--
nosy: +brett.cannon
resolution:  - rejected
status: open - closed
versions:  -Python 2.7

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



[issue3158] Doctest fails to find doctests in extension modules

2013-11-27 Thread Zachary Ware

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


--
status: open - closed

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread Yann Diorcet

Changes by Yann Diorcet diorcet.y...@gmail.com:


--
type:  - crash

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread Yann Diorcet

New submission from Yann Diorcet:

I fell on a bug in ElementTree of Python 2.7.5 (default, Nov 12 2013, 16:18:04)

The bug seems to be here: 
http://hg.python.org/cpython/file/ab05e7dd2788/Modules/_elementtree.c#l2341

uri is NULL and not checked before be passed to strlen

Maybe linked to my expat version: 
expat.i686 2.1.0-5.fc19@fedora  
expat.x86_64   2.1.0-5.fc19@anaconda

--
components: Library (Lib)
files: trace
messages: 204601
nosy: Yann.Diorcet
priority: normal
severity: normal
status: open
title: ElementTree segmentation fault in expat_start_ns_handler
versions: Python 2.7
Added file: http://bugs.python.org/file32872/trace

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Can you please provide use the script wadl.py? Or if it's not possible, can you 
please try to write a short Python script reproducing the crash?

--
nosy: +haypo

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread Christian Heimes

Christian Heimes added the comment:

Indeed, uri might be null: 
http://hg.python.org/cpython/file/ab05e7dd2788/Modules/expat/xmlparse.c#l3157

--
nosy: +christian.heimes
stage:  - needs patch
versions: +Python 3.3, Python 3.4

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



[issue19816] test.regrtest: use tracemalloc to detect memory leaks?

2013-11-27 Thread STINNER Victor

New submission from STINNER Victor:

Someone proposed to use the new tracemalloc module in test.regrtest, I don't 
remember who. Maybe Nick Coghlan?

I tried an hack dash_R(), but the result was not reliable. I should try harder 
:-)

--
components: Tests
messages: 204604
nosy: haypo, ncoghlan, neologix
priority: normal
severity: normal
status: open
title: test.regrtest: use tracemalloc to detect memory leaks?
versions: Python 3.4

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



[issue18983] Specify time unit for timeit CLI

2013-11-27 Thread Julian Gindi

Julian Gindi added the comment:

Updated patch to include unit tests.

--
Added file: http://bugs.python.org/file32874/issue18983.patch

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



[issue19817] tracemalloc add a memory limit feature

2013-11-27 Thread STINNER Victor

New submission from STINNER Victor:

It would be nice to add a memory_limit feature to the tracemalloc to make 
memory allocation fails if it would make the traced memory greater than the 
limit.

See also the pyfailmalloc project which is similar but different:
https://bitbucket.org/haypo/pyfailmalloc

pyfailmalloc doesn't count allocated bytes, it schedules an error in N 
allocations where N is a random number. And pyfailmalloc only schedules one 
error, whereas I propose to make all memory allocations fails until the limit 
is respected.

So if you only 0 bytes free (according to the limit), all memory allocations 
fail until some bytes are freed.

Python currently behaves badly under very low memory condition.

See also the issue #19437.

--
files: tracemalloc_memory_limit.patch
keywords: patch
messages: 204605
nosy: haypo, neologix
priority: normal
severity: normal
status: open
title: tracemalloc add a memory limit feature
versions: Python 3.5
Added file: http://bugs.python.org/file32873/tracemalloc_memory_limit.patch

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



[issue19629] support.rmtree fails on symlinks under Windows

2013-11-27 Thread Jeremy Kloth

Jeremy Kloth added the comment:

The attached patch changes support.rmtree to use os.lstat() instead of the 
builtin _isdir() to test for directory-ness of a path.

--
keywords: +patch
Added file: http://bugs.python.org/file32875/symlink.patch

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



[issue19661] AIX: Python: RuntimeError invalid slot offset when importing a module in _ssl module

2013-11-27 Thread dellair jie

dellair jie added the comment:

I have rebuilt Python 3.3.2 with GCC 4.4.0 on AIX6.1.
There was no warning. But, still seeing the same import offset runtime error:

gcc -pthread -DNDEBUG -g -fwrapv -O0 -Wall -Wstrict-prototypes -IInclude -I. 
-Iopenssl/include -Iopenssl/include -IPython/Python-3.3.2-aix/Include 
-IPython/Python-3.3.2-aix -c Python/Python-3.3.2-aix/Modules/_ssl.c -o 
build/temp.aix-6.1-3.3Python/Python-3.3.2-aix/Modules/_ssl.o

Python/Python-3.3.2-aix/Modules/ld_so_aix gcc -pthread 
-bI:Python/Python-3.3.2-aix/Modules/python.exp 
build/temp.aix-6.1-3.3Python/Python-3.3.2-aix/Modules/_ssl.o -Lopenssl/lib 
-Lopenssl/lib -lssl -lcrypto -o build/lib.aix-6.1-3.3/_ssl.so

*** WARNING: importing extension _ssl failed with 
build/lib.aix-6.1-3.3/_ssl.so: class 'RuntimeError': invalid slot offset: 
traceback object at 0x30378788

--

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



[issue19629] support.rmtree fails on symlinks under Windows

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Why not starting to use pathlib? pathlib.Path(path).resolve().is_dir().

--

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



[issue19798] tracemalloc: rename max_size to peak_size in get_traced_memory() result

2013-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 553144bd7bf1 by Victor Stinner in branch 'default':
Close #19798: replace maximum term with peak in get_traced_memory()
http://hg.python.org/cpython/rev/553144bd7bf1

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

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



[issue19798] tracemalloc: rename max_size to peak_size in get_traced_memory() result

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

 no?

yes, I also prefer current over size.

--
stage: committed/rejected - 

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread Yann Diorcet

Changes by Yann Diorcet diorcet.y...@gmail.com:


Added file: http://bugs.python.org/file32876/aa.tar.gz

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



[issue19629] support.rmtree fails on symlinks under Windows

2013-11-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Why not starting to use pathlib? pathlib.Path(path).resolve().is_dir().

I would rather keep using low-level APIs in test support functions.

--

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



[issue19803] memoryview complain ctypes byte array are not native single character

2013-11-27 Thread HCT

HCT added the comment:

this seems to disagree with the statement of Memoryview currently only knows 
the types from the struct module.

why is memoryview aware of _pack_, a implementation detail of ctypes 
structures. is memoryview a collection of implementation for different types or 
a unique type on its own?


 import ctypes
 class B1(ctypes.Structure):
... _fields_ = [( data, c_uint8 * 256 ), ]
... _pack_ = 1
...
 class B2(ctypes.Structure):
... _fields_ = [( data, c_uint8 * 256 ), ]
...

 a = B1()
 b = B2()
 memoryview( a ).cast( 'B' )
memory at 0x01FFCDC0
 memoryview( b ).cast( 'B' )
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: memoryview: source format must be a native single character format 
prefixed with an optional '@'


--

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



[issue19803] memoryview complain ctypes byte array are not native single character

2013-11-27 Thread HCT

HCT added the comment:

more examples (using 64-bit integer vs 8-bit integer in the above example) to 
show that ctypes aren't being translated for memoryview properly. _pack_ is the 
only way to make memoryview handle ctypes properly


 import ctypes
 class B1(ctypes.Structure):
... _fields_ = [( data, ctypes.c_uint64 * 256 ), ]
... _pack_ = 1
...
 class B2(ctypes.Structure):
... _fields_ = [( data, ctypes.c_uint64 * 256 ), ]
...

 a = B1()
 b = B2()
 memoryview( a ).cast( 'B' )
memory at 0x01FFB030
 memoryview( b ).cast( 'B' )
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: memoryview: source format must be a native single character format 
prefixed with an optional '@'


--

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



[issue19786] tracemalloc: remove arbitrary limit of 100 frames

2013-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eead17ba32d8 by Victor Stinner in branch 'default':
Closes #19786: tracemalloc, remove the arbitrary limit of 100 frames
http://hg.python.org/cpython/rev/eead17ba32d8

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

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



[issue19786] tracemalloc: remove arbitrary limit of 100 frames

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I ran 17 random tests of the Python test suite: the longest traceback contains 
85 frames, the mean is 31.6 frames.

--

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Thanks, I'm able to reproduce the crash using aa.tar.gz.

Python traceback on the crash:

(gdb) py-bt
Traceback (most recent call first):
  File /home/haypo/prog/python/default/Lib/xml/etree/ElementTree.py, line 
1235, in feed
self._parser.feed(data)
  File /home/haypo/prog/python/default/Lib/xml/etree/ElementTree.py, line 
1304, in __next__
self._parser.feed(data)
  File abcd.py, line 18, in _from_stream
for event, elem in ET.iterparse(stream, events):
  File abcd.py, line 30, in module
_from_stream(aa.wadl)

C traceback in gdb:

(gdb) where
#0  0x77258491 in __strlen_sse2_pminub () from /lib64/libc.so.6

#1  0x706124d8 in expat_start_ns_handler (self=0x70ad6d68, 
prefix=0x0, uri=0x0) at 
/home/haypo/prog/python/default/Modules/_elementtree.c:3041

#2  0x703d7fc7 in addBinding (parser=0xa8eea0, prefix=0x77f31c28, 
attId=0x70bbc190, uri=0xaa3720 , bindingsPtr=0x7fff6b58) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:3158

#3  0x703d6de0 in storeAtts (parser=0xa8eea0, enc=0x706011e0 
utf8_encoding_ns, attStr=0xaa4170 ns2:representation 
xmlns:ns2=\http://wadl.dev.java.net/2009/02\; xmlns=\\ element=\org\ 
mediaType=\application/xml\/\n, ' ' repeats 24 times, 
ns2:representation xmlns:ns2=\http://wadl.dev.java.net/20;..., 
tagNamePtr=0x7fff6b10, bindingsPtr=0x7fff6b58) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:2820

#4  0x703d5b3f in doContent (parser=0xa8eea0, startTagLevel=0, 
enc=0x706011e0 utf8_encoding_ns, s=0xaa4170 ns2:representation 
xmlns:ns2=\http://wadl.dev.java.net/2009/02\; xmlns=\\ element=\org\ 
mediaType=\application/xml\/\n, ' ' repeats 24 times, 
ns2:representation xmlns:ns2=\http://wadl.dev.java.net/20;..., end=0xaa42fa 
'\313' repeats 199 times, incomplete sequence \313..., nextPtr=0xa8eed0, 
haveMore=1 '\001') at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:2464

#5  0x703d4b7e in contentProcessor (parser=0xa8eea0, start=0xaa3fd8 
application xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\n 
   include href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, 
doc title=\Generated\ xml:lang=\en\/\n/include\n/gra..., 
end=0xaa42fa '\313' repeats 199 times, incomplete sequence \313..., 
endPtr=0xa8eed0) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:2105

#6  0x703d9d54 in doProlog (parser=0xa8eea0, enc=0x706011e0 
utf8_encoding_ns, s=0xaa3fd8 application 
xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\ninclude 
href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, doc 
title=\Generated\ xml:lang=\en\/\n/include\n/gra..., 
end=0xaa42fa '\313' repeats 199 times, incomplete sequence \313..., tok=29, 
next=0xaa3fd8 application xmlns=\http://wadl.dev.java.net/2009/02\;\n
grammars\ninclude href=\application.wadl/xsd0.xsd\\n, ' ' 
repeats 12 times, doc title=\Generated\ xml:lang=\en\/\n
/include\n/gra..., nextPtr=0xa8eed0, haveMore=1 '\001') at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:4016

#7  0x703d9213 in prologProcessor (parser=0xa8eea0, s=0xaa3fa0 ?xml 
version=\1.0\ encoding=\UTF-8\ standalone=\yes\?\napplication 
xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\ninclude 
href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, doc 
title=..., end=0xaa42fa '\313' repeats 199 times, incomplete sequence 
\313..., nextPtr=0xa8eed0) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:3739

#8  0x703d8cdf in prologInitProcessor (parser=0xa8eea0, s=0xaa3fa0 
?xml version=\1.0\ encoding=\UTF-8\ standalone=\yes\?\napplication 
xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\ninclude 
href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, doc 
title=..., end=0xaa42fa '\313' repeats 199 times, incomplete sequence 
\313..., nextPtr=0xa8eed0) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:3556

#9  0x703d3e6a in XML_ParseBuffer (parser=0xa8eea0, len=858, isFinal=0) 
at /home/haypo/prog/python/default/Modules/expat/xmlparse.c:1651

#10 0x703d3d30 in XML_Parse (parser=0xa8eea0, s=0xaa3330 ?xml 
version=\1.0\ encoding=\UTF-8\ standalone=\yes\?\napplication 
xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\ninclude 
href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, doc 
title=..., len=858, isFinal=0) at 
/home/haypo/prog/python/default/Modules/expat/xmlparse.c:1617

#11 0x70614356 in expat_parse (self=0x70ad6d68, data=0xaa3330 
?xml version=\1.0\ encoding=\UTF-8\ standalone=\yes\?\napplication 
xmlns=\http://wadl.dev.java.net/2009/02\;\ngrammars\ninclude 
href=\application.wadl/xsd0.xsd\\n, ' ' repeats 12 times, doc 
title=..., data_len=858, final=0) at 
/home/haypo/prog/python/default/Modules/_elementtree.c:3351

#12 0x7061470c in xmlparser_feed 

[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-27 Thread Jim Jewett

Jim Jewett added the comment:

These comments refer to 
http://hg.python.org/cpython/file/5c9af8194d3b/Doc/library/tracemalloc.rst 
which is newer than the current patches.

I believe I have consolidated the still-open issues that I see (including those 
that aren't mine) for this file:

http://hg.python.org/cpython/file/5c9af8194d3b/Doc/library/tracemalloc.rst

(line 24, new comment; also repeated at line 315)

frame (1 frame). To store 25 frames at startup: set the
:envvar:`PYTHONTRACEMALLOC` environment variable to ``25``, or use the
:option:`-X` ``tracemalloc=25`` command line option.
-

frame (1 frame). To store 25 frames at startup: set the
:envvar:`PYTHONTRACEMALLOC` environment variable to ``25``, or use the
:option:`-X` ``tracemalloc=25`` command line option.  If tracing is

started later, the maximum number of frames is a parameter to the 

 :func:`start` function.



(line 111)

If the system has little free memory, snapshots can be written on disk using
the :meth:`Snapshot.dump` method to analyze the snapshot offline. Then use the
:meth:`Snapshot.load` method reload the snapshot.

 -

Snapshots can be stored to disk using :meth:`Snapshot.dump` and reloaded using 
:meth:`Snapshot.load`.



(line 180, new comment)
... The traceback is
where the :mod:`importlib` loaded data most recently: on the ``import pdb``
line of the :mod:`doctest` module. The traceback may change if a new module is
loaded.

-

The traceback represents the call stack when those allocations were made.  

As this particular summary is itemized by traceback, it also represents 

the call stack for all 903 of those allocations.


(line 252: new comment)
.. function:: clear_traces()

   Clear traces of memory blocks allocated by Python.

Add Future allocations will still be traced.


Is this just a shortcut for stop();start()  ?  If so, please say so.  If not, 
please explain why.



(Line 311: new comment)
to measure how much memory is used
-
for an approximate measure of how much memory is used


I understand your reluctance to get into too many details, but ... well, it 
isn't a complete measure.  It misses the python objects of tracemalloc itself, 
it misses the overhead of the module, it misses any filenames that were kept 
alive only by tracing, etc.


(Line 372, new comment)
  If *inclusive* is ``True`` (include), only trace memory blocks allocated
  in a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.

  If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in
  a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.
-
  If *inclusive* is ``True`` (include), then trace memory blocks allocated
  in a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.  Also excludes any blocks not selected by any filter.

  If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in
  a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`, even if they would otherwise be included.


(Line 394: new comment)
  This attribute is ignored if the traceback limit is less than ``2``.
-
  This attribute is meaningless if the traceback limit is ``1``.



Just after Line 428, not quite a new issue:
  Compute the differences with an old snapshot. Get statistics as a sorted
  list of :class:`StatisticDiff` instances grouped by *group_by*.

-

  Compute the differences with an old snapshot. Get statistics as a sorted
  list of :class:`StatisticDiff` instances grouped by *group_by*.

  Note that applying different Filters can cause spurious differences; 
users planning to archive a Snapshot may therefore wish to first add various 
annotations.


(Line 454, new comment)
  All inclusive filters are applied at once, a trace is ignored if no
  inclusive filters match it. A trace is ignored if at least one exclusive
  filter matchs it.
-
  If there are any inclusive filters, then they are all applied, and traces 
which do not match at least one of them are excluded.  A trace is also ignored 
if at least one exclusive
  filter matches it.


Line 544, new comment:

   .. attribute:: count_diff

  Difference of number of memory blocks between the old and the new
  snapshots (``int``): ``0`` if the memory blocks have been allocated in
  the new snapshot.
-
   .. attribute:: count_diff

  Difference of number of memory blocks between the old and the new
  snapshots (``int``).  count_diff==count if the memory blocks do not 
appear in the old snapshot.

Line 558, similar to above:
  the new snapshots (``int``): ``0`` if the memory blocks have been
  allocated in the new snapshot.
-
  the new snapshots (``int``).  size_diff==size if the memory blocks do not 
appear in the old snapshot.

--
nosy: +Jim.Jewett

___
Python tracker 

[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-27 Thread Jim Jewett

Jim Jewett added the comment:

Drat:  forgot one at line 277


.. function:: get_traced_memory()

   Get the current size and maximum size of memory blocks traced by the
   :mod:`tracemalloc` module as a tuple: ``(size: int, max_size: int)``.

I have a tendency to read maximum size as the most it is willing/able to 
trace, rather than the most it has traced at a single time so far.  I therefore 
prefer peak_size.

Also, this doesn't suggests that the object is strictly a tuple, and that 
results.size or results.peak_size will not work; is that intentional?

--

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



[issue19818] tracemalloc: comments on the doc

2013-11-27 Thread STINNER Victor

New submission from STINNER Victor:

Jim Jewett posted the message msg204618 to the issue #18874 which is now 
closed, so I'm opening a new issue. Copy of his message.


These comments refer to 
http://hg.python.org/cpython/file/5c9af8194d3b/Doc/library/tracemalloc.rst 
which is newer than the current patches.

I believe I have consolidated the still-open issues that I see (including those 
that aren't mine) for this file:

http://hg.python.org/cpython/file/5c9af8194d3b/Doc/library/tracemalloc.rst

(line 24, new comment; also repeated at line 315)

frame (1 frame). To store 25 frames at startup: set the
:envvar:`PYTHONTRACEMALLOC` environment variable to ``25``, or use the
:option:`-X` ``tracemalloc=25`` command line option.
-

frame (1 frame). To store 25 frames at startup: set the
:envvar:`PYTHONTRACEMALLOC` environment variable to ``25``, or use the
:option:`-X` ``tracemalloc=25`` command line option.  If tracing is

started later, the maximum number of frames is a parameter to the 

 :func:`start` function.



(line 111)

If the system has little free memory, snapshots can be written on disk using
the :meth:`Snapshot.dump` method to analyze the snapshot offline. Then use the
:meth:`Snapshot.load` method reload the snapshot.

 -

Snapshots can be stored to disk using :meth:`Snapshot.dump` and reloaded using 
:meth:`Snapshot.load`.



(line 180, new comment)
... The traceback is
where the :mod:`importlib` loaded data most recently: on the ``import pdb``
line of the :mod:`doctest` module. The traceback may change if a new module is
loaded.

-

The traceback represents the call stack when those allocations were made.  

As this particular summary is itemized by traceback, it also represents 

the call stack for all 903 of those allocations.


(line 252: new comment)
.. function:: clear_traces()

   Clear traces of memory blocks allocated by Python.

Add Future allocations will still be traced.


Is this just a shortcut for stop();start()  ?  If so, please say so.  If not, 
please explain why.



(Line 311: new comment)
to measure how much memory is used
-
for an approximate measure of how much memory is used


I understand your reluctance to get into too many details, but ... well, it 
isn't a complete measure.  It misses the python objects of tracemalloc itself, 
it misses the overhead of the module, it misses any filenames that were kept 
alive only by tracing, etc.


(Line 372, new comment)
  If *inclusive* is ``True`` (include), only trace memory blocks allocated
  in a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.

  If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in
  a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.
-
  If *inclusive* is ``True`` (include), then trace memory blocks allocated
  in a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`.  Also excludes any blocks not selected by any filter.

  If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in
  a file with a name matching :attr:`filename_pattern` at line number
  :attr:`lineno`, even if they would otherwise be included.


(Line 394: new comment)
  This attribute is ignored if the traceback limit is less than ``2``.
-
  This attribute is meaningless if the traceback limit is ``1``.



Just after Line 428, not quite a new issue:
  Compute the differences with an old snapshot. Get statistics as a sorted
  list of :class:`StatisticDiff` instances grouped by *group_by*.

-

  Compute the differences with an old snapshot. Get statistics as a sorted
  list of :class:`StatisticDiff` instances grouped by *group_by*.

  Note that applying different Filters can cause spurious differences; 
users planning to archive a Snapshot may therefore wish to first add various 
annotations.


(Line 454, new comment)
  All inclusive filters are applied at once, a trace is ignored if no
  inclusive filters match it. A trace is ignored if at least one exclusive
  filter matchs it.
-
  If there are any inclusive filters, then they are all applied, and traces 
which do not match at least one of them are excluded.  A trace is also ignored 
if at least one exclusive
  filter matches it.


Line 544, new comment:

   .. attribute:: count_diff

  Difference of number of memory blocks between the old and the new
  snapshots (``int``): ``0`` if the memory blocks have been allocated in
  the new snapshot.
-
   .. attribute:: count_diff

  Difference of number of memory blocks between the old and the new
  snapshots (``int``).  count_diff==count if the memory blocks do not 
appear in the old snapshot.

Line 558, similar to above:
  the new snapshots (``int``): ``0`` if the memory blocks have been
  allocated in the new snapshot.
-
  the new snapshots (``int``).  size_diff==size if the memory blocks 

[issue19818] tracemalloc: comments on the doc

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

And copy of his second message msg204619:

Drat:  forgot one at line 277


.. function:: get_traced_memory()

   Get the current size and maximum size of memory blocks traced by the
   :mod:`tracemalloc` module as a tuple: ``(size: int, max_size: int)``.

I have a tendency to read maximum size as the most it is willing/able to 
trace, rather than the most it has traced at a single time so far.  I therefore 
prefer peak_size.

Also, this doesn't suggests that the object is strictly a tuple, and that 
results.size or results.peak_size will not work; is that intentional?

--

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



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

@Jim: This issue has been closed, please don't comment closed issues. I created 
a new issue for your new comments: #19818.

--

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread Christian Heimes

Christian Heimes added the comment:

The patch removes the cause of the segfault but I'm no sure if that's the right 
way. I'm adding Eli und Stefan to the ticket.

--
keywords: +patch
nosy: +eli.bendersky, scoder
Added file: http://bugs.python.org/file32877/empty_uri.patch

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



[issue19815] ElementTree segmentation fault in expat_start_ns_handler

2013-11-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +fdrake

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



[issue19818] tracemalloc: comments on the doc

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

 I have a tendency to read maximum size as the most it is willing/able to 
 trace, rather than the most it has traced at a single time so far.  I 
 therefore prefer peak_size.

I already replied to this comment on Rietveld, I created the issue #19798 which 
is already fixed.

--

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



[issue19818] tracemalloc: comments on the doc

2013-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8df54b9b99ef by Victor Stinner in branch 'default':
Issue #19818: tracemalloc, the number of frame limit cannot be zero anymore
http://hg.python.org/cpython/rev/8df54b9b99ef

--
nosy: +python-dev

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



[issue19818] tracemalloc: comments on the doc

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Could you please write a patch on Doc/library/tracemalloc.rst? It's really hard 
to review your raw comments in comments.

You should probably sign the contributor agreement.
http://www.python.org/psf/contrib/contrib-form/


Is [clear_traces()] just a shortcut for stop();start()  ?  If so, please say so.


It's almost the same. clear_traces() does not uninstall and reinstall hooks on 
memory allocators. I prefer to not give too much details in the high-level 
documentation.


Line 558, similar to above:
  the new snapshots (``int``): ``0`` if the memory blocks have been
  allocated in the new snapshot.
-
  the new snapshots (``int``).  size_diff==size if the memory blocks do not 
appear in the old snapshot.


This is not correct, size_diff is 0 if memory blocks are new, not size.

--

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



[issue19146] Improvements to traceback module

2013-11-27 Thread Guido van Rossum

Guido van Rossum added the comment:

I decided to abandon this project and close the issue as wontfix.

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

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-27 Thread Larry Hastings

New submission from Larry Hastings:

Read this today:

http://mortoray.com/2013/11/27/the-string-type-is-broken/

In it the author talks about how the 'ffl' ligature breaks some string 
processing.  He claimed that Python 3 doesn't uppercase it correctly--well, it 
does.  However I discovered that it doesn't reverse it properly.

x = b'ba\xef\xac\x84e'.decode('utf-8') # baffle, where ffl is a ligature
print(x) # prints baffle, with the ligature
print(x.upper())  # prints BAFFLE, no ligature, which is fine
print(.join(reversed(x))) # prints efflab

Shouldn't that last line print elffab?

If this gets marked as wontfix I wouldn't complain.  Just wondering what the 
Right Thing is to do here.

--
messages: 204628
nosy: larry
priority: low
severity: normal
stage: needs patch
status: open
title: reversing a Unicode ligature doesn't work
type: behavior
versions: Python 3.4

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-27 Thread Christian Heimes

Christian Heimes added the comment:

There is no ligature for lff, just ffl. Ligatures are treated as one char. 
I guess Python would have to grow a str.reverse() method to handle ligatures 
and combining chars correctly.

At work I ran into the issue with ligatures and combining chars multiple times 
in medieval and early modern age scripts. Eventually I started to normalize all 
incoming data to NFKC. That solves most of the issues.

s = b'ba\xef\xac\x84e'.decode('utf-8')
 print(.join(reversed(s)))
efflab
 print(.join(reversed(unicodedata.normalize(NFKC, s
elffab

--
nosy: +christian.heimes

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-27 Thread Christian Heimes

Christian Heimes added the comment:

A proper str.reverse function must deal with more extra cases. For example 
there are special rules for the Old German long s (ſ) and the round s (s). A 
round s may only occur at the end of a syllable. Hebrew has a special variant 
of several characters if the character is placed at the end of a word (HEBREW 
LETTER PE / HEBREW LETTER FINAL PE).

A simple reversed(s) can never deal with all the complicated rules.

--

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Python implements the Unicode standards. Except if Python failed to implement 
the standard correctly, the author should complain to the Unicode Consortium 
directly!
http://www.unicode.org/contacts.html

Example of data for the ffl character, U+FB04:

FB04;LATIN SMALL LIGATURE FFL;Ll;0;L;compat 0066 0066 006CN;

http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt

(I'm unable to decode these raw data :-))

--
nosy: +haypo

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



[issue19819] reversing a Unicode ligature doesn't work

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand the purpose of using reversed(). Don't use it to display a 
text backward. Handling bidirectional text requires more complex tools to 
display such text. See for example the pango library:
https://developer.gnome.org/pango/stable/pango-Bidirectional-Text.html

I don't see anything wrong with Python here, it just implements the Unicode 
standards, so I'm closing the issue as invalid.

--
resolution:  - invalid
status: open - closed

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



[issue19757] _tracemalloc.c: compiler warning with gil_state

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Hum, Clang is not kind enough to understand that gil_state is not used when 
uninitialized.

Well, I always hesitated to refactor the code. So here is a cleanup which moves 
PyGILState_Ensure/PyGILState_Release to the caller. It duplicates a few lines 
of code, but the new code should be more readable.

--
keywords: +patch
Added file: http://bugs.python.org/file32878/cleanup.patch

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



[issue19766] test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x buildbot: urllib3 dependency requires the threading module

2013-11-27 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: test_venv: test_with_pip() failed on AMD64 Fedora without threads 3.x 
buildbot - test_venv: test_with_pip() failed on AMD64 Fedora without threads 
3.x buildbot: urllib3 dependency requires the threading module

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



[issue17232] Improve -O docs

2013-11-27 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

Oh, here is in interesting commit:
---
changeset:   33705:891042c94aed
branch:  legacy-trunk
user:Tim Peters tim.pet...@gmail.com
date:Sat Oct 09 22:33:09 2004 +
files:   Python/thread.c
description:
Document the results of painful reverse-engineering of the portable TLS
code.

PyThread_set_key_value():  It's clear that this code assumes the passed-in
value isn't NULL, so document that it must not be, and assert that it
isn't.  It remains unclear whether existing callers want the odd semantics
actually implemented by this function.
---

Here is a patch adding a _PyThread_set_key_value() function which behaves as I 
expected.

It looks like PyThread_set_key_value() got its strange behaviour from the 
find_key() of Python/thread.c.

Don't hesistate if you have a better suggestion for the name if the new 
function :-)

Another option is to modify directly the existing function, but it might break 
applications relying on the current (weird) behaviour.

--
keywords: +patch
nosy: +pitrou, tim.peters
Added file: http://bugs.python.org/file32879/pythread_set_key_value.patch

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



[issue19765] test_asyncio: test_create_server() failed on x86 Windows Server 2008 [SB] 3.x

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I didn't see the failure recently, so I hope that it was fixed. I close the 
issue. I will reopen it if I see the failure again.

Thanks Guido for your fix.

--
resolution:  - fixed
status: open - closed

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



[issue19787] tracemalloc: set_reentrant() should not have to call PyThread_delete_key()

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I ran test_tracemalloc on Linux and Windows and the test passed successfully.

It should probably be better to split the patch in two parts if the idea of 
changing Python/thread* files is accepted. (But initially, the issue comes from 
the tracemalloc module.)

set_reentrant() of tracemalloc.c:

+assert(PyThread_get_key_value(tracemalloc_reentrant_key) == REENTRANT);

I also added a new assertion to ensure that set_reentrant(0) was not called 
twice. It was a suggesed of Jim Jewett.

This is unrelated to this issue and should be commited separatly.

--

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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

The purpose of this issue is to avoiding having to call CreateProcess() with 
bInheritHandles parameter set to TRUE on Windows, and avoid calls to 
self._make_inheritable() in subprocess.Popen._get_handles().

Currently, bInheritHandles is set to TRUE if stdin, stdout and/or stderr 
parameter of Popen constructor is set (to something else than None).

Using PROC_THREAD_ATTRIBUTE_HANDLE_LIST, handles don't need to be marked as 
inheritable in the parent process, and CreateProcess() can be called with 
bInheritHandles parameter set to FALSE.

--

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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

UpdateProcThreadAttribute() documentation says that ... handles must be 
created as inheritable handles ... and a comment says that If using 
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, pass TRUE to bInherit in CreateProcess. 
Otherwise, you will get an ERROR_INVALID_PARAMETER.

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

Seriously? What is the purpose of PROC_THREAD_ATTRIBUTE_HANDLE_LIST if it does 
not avoid the race condition? It's just to not inherit some inheritable 
handles? In Python 3.4, files and sockets are created non-inheritable by 
default, so PROC_THREAD_ATTRIBUTE_HANDLE_LIST may not improve anything :-/

--

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



[issue19775] Provide samefile() on Path objects

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I like the idea :-)

--
nosy: +gvanrossum, haypo

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



[issue19776] Provide expanduser() on Path objects

2013-11-27 Thread STINNER Victor

STINNER Victor added the comment:

I wanted to suggest to modify the resolve() method, but '~' is a valid 
filename... (I tested, and it's annoying because depending on command, 
sometimes ~ is expanded to /home/haypo sometimes not...)

--
nosy: +haypo

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



[issue19595] Silently skipped test in test_winsound

2013-11-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6f1c5d0b44ed by Zachary Ware in branch 'default':
Issue #19595: Re-enable a long-disabled test in test_winsound
http://hg.python.org/cpython/rev/6f1c5d0b44ed

--
nosy: +python-dev

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



[issue19820] docs are missing info about module attributes

2013-11-27 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
keywords: +easy

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



  1   2   >