[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Charles-François Natali

Charles-François Natali added the comment:

> Tin Tvrtković added the comment:
>
> For your examples, my first instinct would be to use a thread pool executor. 
> It's a nice high level API and can already do the aggregate join.

Indeed, the examples posted don't make much sense: thread/process
pools are the way to go.

--

___
Python tracker 

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



[issue22020] tutorial 9.10. Generators statement error

2014-07-20 Thread Ezio Melotti

Ezio Melotti added the comment:

The "reverse" function is defined just above the example that uses it.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, ezio.melotti
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue22020] tutorial 9.10. Generators statement error

2014-07-20 Thread Albert Ho

New submission from Albert Ho:

https://docs.python.org/3/tutorial/classes.html
>>> for char in reverse('golf'):

I found that reverse didnt work
and i check the doc
https://docs.python.org/3.4/library/functions.html#reversed
>>> reversed(seq)¶

I guess it just forget to change the statement

--
messages: 223560
nosy: rt135792005
priority: normal
severity: normal
status: open
title: tutorial 9.10. Generators statement error
type: compile error
versions: Python 3.4

___
Python tracker 

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



[issue11945] Adopt and document consistent semantics for handling NaN values in containers

2014-07-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Closing for the reasons listed and also because there is another pair of 
tracker items 22000 and 22001 pursuing related documentation updates.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue21868] Tbuffer in turtle allows negative size

2014-07-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks for the patch Lita.  This was a nice fix.

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

___
Python tracker 

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



[issue21868] Tbuffer in turtle allows negative size

2014-07-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 02b25ec13c94 by Raymond Hettinger in branch '3.4':
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
http://hg.python.org/cpython/rev/02b25ec13c94

--

___
Python tracker 

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



[issue21868] Tbuffer in turtle allows negative size

2014-07-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 847a0e74c4cc by Raymond Hettinger in branch '2.7':
Issue #21868: Prevent turtle crash due to invalid undo buffer size.
http://hg.python.org/cpython/rev/847a0e74c4cc

--
nosy: +python-dev

___
Python tracker 

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



[issue22019] ntpath.join() error with Chinese character Path

2014-07-20 Thread StupidHod

StupidHod added the comment:

You are correct,the resultpath is unicode and path is str.Tks for your
comments.

2014-07-21 10:15 GMT+08:00 Ezio Melotti :

>
> Ezio Melotti added the comment:
>
> Agreed.  Make sure that the arguments you are passing to ntpath.join()
> have the same type (i.e. either both unicode, or both string).
>
> --
> nosy: +ezio.melotti
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue22019] ntpath.join() error with Chinese character Path

2014-07-20 Thread Ezio Melotti

Ezio Melotti added the comment:

Agreed.  Make sure that the arguments you are passing to ntpath.join() have the 
same type (i.e. either both unicode, or both string).

--
nosy: +ezio.melotti
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue22019] ntpath.join() error with Chinese character Path

2014-07-20 Thread Zachary Ware

Zachary Ware added the comment:

What type are your arguments, str, unicode, or a mix?  I can reproduce your 
issue using a unicode and a str containing a non-ASCII character, while any 
other combination "works":

>>> import os
>>> os.path.join('test', 'test\x85')
'test\\test\x85'
>>> os.path.join('test', u'test\x85')
u'test\\test\x85'
>>> os.path.join(u'test', 'test\x85')
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\lib\ntpath.py", line 84, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0x85 in position 4: ordinal 
not in range(128)
>>> os.path.join(u'test', u'test\x85')
u'test\\test\x85'

The fact that any mixed-type combination works is sheer accident.  This is just 
a side effect of Python 2's 'bolted-on' approach to Unicode, and the fix is to 
upgrade to Python 3.  If you have to stay with Python 2, you can try to fix 
your code by making sure you decode all input to unicode as soon as you get it, 
and only encode to str when you have to (which is basically what you need to do 
in Python 3, but Python won't give you helpful exceptions at the source of the 
problem in 2.x).

I don't believe there's anything that should be changed in ntpath.join.

--
nosy: +zach.ware

___
Python tracker 

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



[issue22019] ntpath.join() error with Chinese character Path

2014-07-20 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue22019] ntpath.join() error with Chinese character Path

2014-07-20 Thread StupidHod

New submission from StupidHod:

When ntpath.join() works with a path that with Chinese character ,a unicode 
Decode error will happen.
detailes as:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb2 in position 0: ordinal 
not in range(128)

As the interparter said,it happened at
result_path = result_path + p_path line 84.

as I modif this expression with "result_path = str(result_path) + 
str(p_path)",it works well.

--
components: Library (Lib)
messages: 223552
nosy: StupidHod
priority: normal
severity: normal
status: open
title: ntpath.join() error with Chinese character Path
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-20 Thread Andrew Barnert

Changes by Andrew Barnert :


Added file: http://bugs.python.org/file36009/pep-peek.txt

___
Python tracker 

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-20 Thread Andrew Barnert

Changes by Andrew Barnert :


Added file: http://bugs.python.org/file36008/pep-newline.txt

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread Guido van Rossum

Guido van Rossum added the comment:

My worry is that somehow a program has a fd that refers to both a file and a 
socket. But I agree that changing the API is not a great option either.

--

___
Python tracker 

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



[issue16778] Logger.findCaller needs to be smarter

2014-07-20 Thread Michael Rohan

Michael Rohan added the comment:

I recently implemented a custom logger derived from Logger and to get the
reporting of modules, etc, correct, I implemented the findCaller using
the same code as library code with the minor change of

if filename == _srcfile:

to

if filename in [logging._srcfile, _mysrcfile]:

with the local _mysrcfile being determined the same as in logging.

Maybe simply having a class list "srcfiles = [_srcfile]" and allowing
people who customize extend this would be the easiest way of handling
this: "Logger.srcfiles.append(_mysrcfile)"

--
nosy: +mrohan

___
Python tracker 

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



[issue22001] containers "same" does not always mean "__eq__".

2014-07-20 Thread Jim Jewett

Jim Jewett added the comment:

Ah... "be the same object or compare equal" sounds much better.

I don't want "same" to sound like an informal  wording for equal,  because
getting rid of the confusion over NaN and similar objects is the whole
point of the revision.  On the other hand, I don't want the language spec
to imply that a more careful custom container is non-conforming.

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand. My patch works for files and sockets on all platforms.
What is the problem? You don't like the idea of checking the file type?

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Claudiu Popa

Claudiu Popa added the comment:

This seems indeed like a weaker version of ThreadPoolExecutor. Here's how your 
example looks with it, not very different and still easy to understand and 
grasp:


from concurrent.futures import ThreadPoolExecutor
from urllib.request import urlretrieve

with ThreadPoolExecutor(max_workers=3) as executor:
url = 'http://www.{site}.org/'
for site in ('perl', 'python', 'jython', 'pypy'):
future = executor.submit(urlretrieve, url.format(site=site), site)



3 lines without imports and the initialisation of the pool.

--
nosy: +Claudiu.Popa

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Tin Tvrtković

Tin Tvrtković added the comment:

For your examples, my first instinct would be to use a thread pool executor. 
It's a nice high level API and can already do the aggregate join.

--
nosy: +tinchester

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> Even the Java API doesn't look very useful.

This isn't a Java-only concept.  It is widely available.  Here's a sample:

c++
"thread_group provides for a collection of threads that are related in some 
fashion."
http://www.boost.org/doc/libs/1_35_0/doc/html/thread/thread_management.html#thread.thread_management.threadgroup

perl
"Thread::Pool - group of threads for performing similar jobs"
http://search.cpan.org/dist/Thread-Pool/lib/Thread/Pool.pm

haskell
"This module extends Control.Concurrent.Thread with the ability to wait for a 
group of threads to terminate."
http://hackage.haskell.org/package/threads-0.5.0.2/docs/Control-Concurrent-Thread-Group.html

ruby
"ThreadGroup provides a means of keeping track of a number of threads as a 
group."
http://www.ruby-doc.org/core-2.1.2/ThreadGroup.html

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
Removed message: http://bugs.python.org/msg223544

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

c++
"thread_group provides for a collection of threads that are related in some 
fashion."
http://www.boost.org/doc/libs/1_35_0/doc/html/thread/thread_management.html#thread.thread_management.threadgroup

perl
"Thread::Pool - group of threads for performing similar jobs"
http://search.cpan.org/dist/Thread-Pool/lib/Thread/Pool.pm

> Even the Java API doesn't look very useful.

This isn't a Java-only concept.  It is widely available.

haskell
"This module extends Control.Concurrent.Thread with the ability to wait for a 
group of threads to terminate."
http://hackage.haskell.org/package/threads-0.5.0.2/docs/Control-Concurrent-Thread-Group.html

ruby
"ThreadGroup provides a means of keeping track of a number of threads as a 
group."
http://www.ruby-doc.org/core-2.1.2/ThreadGroup.html

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread Guido van Rossum

Guido van Rossum added the comment:

So perhaps an int or a socket?

--

___
Python tracker 

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



[issue22003] BytesIO copy-on-write

2014-07-20 Thread David Wilson

David Wilson added the comment:

I'm not sure the "read only buffer" test is strong enough: having a readonly 
view is not a guarantee that the data in the view cannot be changed through 
some other means, i.e. it is read-only, not immutable.

Pretty sure this approach is broken. What about the alternative approach of 
specializing for Bytes?

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +Christian.Tismer, aleax, kristjan.jonsson, lemburg

___
Python tracker 

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



[issue7676] IDLE shell shouldn't use TABs

2014-07-20 Thread Terry J. Reedy

Terry J. Reedy added the comment:

To continue and expand some things I said in various messages above...

The reason Shell does not and indeed should not have a secondary line prompt is 
that in Shell, '>>> ' means 'Enter a statement:' rather than just a line. Being 
able to enter, edit, and recall complete statements rather than just lines is 
an important feature of Idle's Shell.

For proportional fonts, I suspect the tab stops are every 8 em quads. A em quad 
(named after M) is square, so it is as wide as the font is high.

In msg151418 I suggested that the solution is to not mix prompts with user 
input, as is done. I gave the narrow prompt window as fix 3. I suggested as fix 
1 to put statement prompts and output indications on separate lines. Here is a 
mockup example.

>>>:
def f(x):
if x:
print('got it')
return 'something'
>>>:
f(3)
---
got it
>>>:

(The 'blank line' signaling 'end of statement' is intentionally suppressed.) 
This should be easy to do and, to me, looks pretty decent. The hesitation I had 
before is the copy for paste problem, but if that is a custom function, it 
would not be hard to reformat. A minor problem is the output could include 
'>>>:\n' or '---\n', but today one can do

>>> print(">>> def fake():\n\treturn 'def'\n")
>>> def fake():
return 'def'

>>>

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> The example looks like something you could use concurrent.futures for

The example was minimal to show how it works.  The concept of having groups of 
related threads is perfectly general.  It is a tool for organizing and 
reasoning about code more complex than this.  

The main virtue is in the aggregate join operation (wait for all workers doing 
a given kind of task to finish).  I believe this is reasonably common (I've 
seen aggregate joins at more than one client). 

The goal is to simplify common patterns of parallel work in phases (each phase 
must be complete before the next phase starts).

Old way:

phase1_workers = []
for data in pool:
t = threading.Thread(target=phase1, args=(data,))
t.start()
phase1_workers.append(t)
for t in phase1_workers:
t.join()

phase2_workers = []
for data in phase1_pool:
t = threading.Thread(target=phase2, args=(data,))
t.start()
phase2_workers.append(t)
for t in phase2_workers:
t.join()

phase3_workers = []
for data in phase2_pool:
t = threading.Thread(target=phase3, args=(data,))
t.start()
phase3_workers.append(t)
for t in phase3_workers:
t.join()

print('Done')

New way with cleaner code:

phase1 = SimpleThreadGroup('phase1')
phase2 = SimpleThreadGroup('phase2')
phase3 = SimpleThreadGroup('phase3')

for data in pool:
t = threading.Thread(phase1, phase1_task, args=(data,)).start()
phase1.join()

for data in phase1_pool:
t = threading.Thread(phase2, phase2_task, args=(data,)).start()
phase2.join()

for data in phase2_pool:
t = threading.Thread(phase3, phase3_task, args=(data,)).start()
phase3.join()

print('Done')

The new code is easier to write, to reason about, and to maintain because the 
thread group takes care of building the aggregate collection and applying the 
aggregate join operation to make sure each phase is complete before going on to 
the next phase (i.e. all sprites moved, all user inputs processed, all monsters 
generated, all conflicts resolved, all points accumulated, all bonuses applied, 
...)

As discussed in 
http://journals.ecs.soton.ac.uk/java/tutorial/java/threads/threadgroup.html , 
the feature would be more useful if we had the ability to suspend, resume, or 
stop collections of threads, but our threading have more limited controls 
(check name, get identifier, check whether the thread is alive, and most 
usefully wait for the thread with a join).

For people who write complex multi-threaded code (i.e. my clients), this would 
offer a nice simplification.  I don't see any reason to leave this feature left 
as a stub in perpetuity.

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

> Perhaps the API should take a socket object on Windows to avoid any confusion?

I don't know if the feature is useful, but signal.set_wakeup_fd() works on 
Windows since at least Python 2.7 and accepts files. Only supporting sockets 
would be a regression.

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread Guido van Rossum

Guido van Rossum added the comment:

Perhaps the API should take a socket object on Windows to avoid any confusion?

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Removed file: http://bugs.python.org/file35998/parallel_download_application.py

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file36007/parallel_download_application.py

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

Guido wrote:
"I don't know much about how sockets are implemented on Windows; is there a 
guarantee that the space of possible socket fds doesn't overlap the space of 
possible stream fds?"

Python has a low-level _PyVerify_fd() which uses the __pioinfo private array. 
It looks socket "handles" (small integers betwen 256 and 1000 in my quick 
tests) and file descriptors overlap. Files get file descriptors between 0 and 
2047.

--

___
Python tracker 

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



[issue22002] Make full use of test discovery in test subpackages

2014-07-20 Thread Mark Lawrence

Mark Lawrence added the comment:

I'm getting lost in all the enhancement requests for tests.  How does this 
relate to e.g. 16748 or 10572?

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue22017] Bad reference counting in the _warnings module

2014-07-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8106f91fccd6 by Benjamin Peterson in branch '2.7':
correct ref counting of default_action (closes #22017)
http://hg.python.org/cpython/rev/8106f91fccd6

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread Guido van Rossum

Guido van Rossum added the comment:

I don't know much about how sockets are implemented on Windows; is there a 
guarantee that the space of possible socket fds doesn't overlap the space of 
possible stream fds?

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

I tested manually test_signal.test_socket() on Windows 7: the test pass.

The test is currently skipped on Windows because the whole TestCase is skipped. 
Moreover, there is no socket.socketpair() function on Windows. For the manual 
test, I used asyncio.windows_utils.socketpair(). I prefer to not make 
test_signal depends on the asyncio module.

--

___
Python tracker 

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



[issue22018] signal: accept socket for signal.set_wakeup_fd()

2014-07-20 Thread STINNER Victor

New submission from STINNER Victor:

Hi,

I'm working on asyncio, someone asked why asyncio cannot be interrupted by 
CTRL+c (SIGINT):
https://code.google.com/p/tulip/issues/detail?id=191

On Windows, select.select() is not interrupted by CTRL+c. To get a reliable 
behaviour, interrupt select.select() on a signal, we can use 
signal.set_wakeup_fd(). New problem: on Windows, select.select() only supports 
sockets.

I propose to modify signal.set_wakeup_fd() to not only support files (use 
write), but also sockets (use send). Attached patch implements that.

This issue is part of a global PEP to modify how Python handles EINTR. I'm 
writing a PEP on that with Charles-François Natali. The idea to retry on EINTR 
in some cases, like write(), so we need a way to wakeup the code on a signal, 
on all platforms.


Questions:

- I had to modify the pythoncore Visual Studio project to add a dependency to 
the WinSock library ("ws2_32.lib"). Is it a bad thing? We may split the _signal 
module into a new project, to only put the dependency there. What do you think? 
I'm not sure that it makes sense because the _signal module is always imported 
at Python startup, by initsigs() (search for the call to PyOS_InitInterrupts()).


- PySignal_SetWakeupFd() returns the old file descriptor, which is -1 by 
default. The API is not written to report errors. I chose to return -2 and 
clear the Python exception. Should we add a new function raising a Python 
exception on error? Ex: "int PySignal_SetWakeupFdWithError(int fd, int 
*old_fd)" returns 0 on success, -1 on error.


+/* Import the _socket module to call WSAStartup() */
+mod = PyImport_ImportModuleNoBlock("_socket");

I chose to import the _socket module because calling WSAStartup() requires also 
to call WSACleanup() at exit. I don't want to have two modules responsible for 
that.

I'm using "getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)" to check if fd is a 
socket. Is there a better function to check if a file descriptor or handle is a 
socket?

According to the documentation, "GetFileType(handle) == FILE_TYPE_PIPE" is true 
for sockets, but also for (named and anonymous) pipes.

--
components: Windows, asyncio
files: signal_socket.patch
keywords: patch
messages: 223532
nosy: gvanrossum, haypo, loewis, neologix, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: signal: accept socket for signal.set_wakeup_fd()
versions: Python 3.5
Added file: http://bugs.python.org/file36006/signal_socket.patch

___
Python tracker 

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



[issue22007] sys.stdout.write on Python 2.7 is not EINTR safe

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

I'm interested to work on all EINTR issues, including Python 2.

I'm working on a new PEP with Charles-François Natali to address *all* EINTR at 
once in Python 3.5. If the PEP is accepted, we may fix some EINTR issues on 
Python 2. Some changes change the behaviour and so cannot we done in Python 2. 
Well, the PEP is still a draft, we will see that later.

--
nosy: +neologix

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

The example looks like something you could use concurrent.futures for and get 
more features besides?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue22011] test_os extended attribute setxattr tests can fail with ENOSPC (Errno 28)

2014-07-20 Thread Ned Deily

Ned Deily added the comment:

My reading of the man page is that in the xattr case it can refer to conditions 
other than just file system full, e.g. 
https://bugzilla.kernel.org/show_bug.cgi?id=12793.  Also, Yannick reported that 
the volume was apparently not full.

--

___
Python tracker 

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



[issue22011] test_os extended attribute setxattr tests can fail with ENOSPC (Errno 28)

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

If "insuffcient space" is insufficient disk space (ie: /tmp is full), I don't 
see any reason the test should cater to that possibility.  None of our other 
tests do.  If it means something else, then nevermind.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue22007] sys.stdout.write on Python 2.7 is not EINTR safe

2014-07-20 Thread Ned Deily

Ned Deily added the comment:

I also can reproduce this on Linux with Python 2.7 but not with 3.4 which uses 
a different io system.  So the question is: is anyone interested in addressing 
this for Python 2 file objects?

--
nosy: +gregory.p.smith
stage:  -> needs patch
title: sys.stdout.write on OS X is not EINTR safe -> sys.stdout.write on Python 
2.7 is not EINTR safe

___
Python tracker 

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



[issue22003] BytesIO copy-on-write

2014-07-20 Thread David Wilson

David Wilson added the comment:

New patch also calls unshare() during getbuffer()

--
Added file: http://bugs.python.org/file36005/cow3.patch

___
Python tracker 

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



[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack

2014-07-20 Thread Wolfgang Maier

Changes by Wolfgang Maier :


--
nosy: +wolma

___
Python tracker 

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



[issue17131] subprocess.Popen.terminate can raise exception on Posix

2014-07-20 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
stage:  -> needs patch

___
Python tracker 

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



[issue17665] convert test_wsgiref to idiomatic unittest code

2014-07-20 Thread Mark Lawrence

Mark Lawrence added the comment:

Changes were made to this module on #20555.

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue17131] subprocess.Popen.terminate can raise exception on Posix

2014-07-20 Thread Gregory P. Smith

Gregory P. Smith added the comment:

agreed, we could at least do that for the Popen methods.

--

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2014-07-20 Thread paul j3

paul j3 added the comment:

I think you want to unlink 9ac347a7f375.diff 

It's from a different project

--

___
Python tracker 

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



[issue22017] Bad reference counting in the _warnings module

2014-07-20 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue22003] BytesIO copy-on-write

2014-07-20 Thread David Wilson

David Wilson added the comment:

This version is tidied up enough that I think it could be reviewed.

Changes are:

 * Defer `buf' allocation until __init__, rather than __new__ as was previously 
done. Now upon completion, BytesIO.__new__ returns a valid, closed BytesIO, 
whereas previously a valid, empty, open BytesIO was returned. Is this interface 
change permissible?

 * Move __init__ guts into a "reinit()", for sharing with __setstate__, which 
also previously caused an unnecessary copy. Additionally gather up various 
methods for deallocating buffers into a single "reset()" function, called by 
reinit(), _dealloc(), and _close()

 * Per Stefan's suggested approach, reinit() now explicitly checks for a 
read-only buffer, falling back to silently performing a copy if the returned 
buffer is read-write. That seems vastly preferable to throwing an exception, 
which would probably be another interface change.

 * Call `unshare()` any place the buffer is about to be modified. If the buffer 
needs to be made private, it also accepts a size hint indicating how much 
less/more space the subsequent operation needs, to avoid a redundant 
reallocation after the unsharing.


Outstanding issues:

 * I don't understand why buf_size is a size_t, and I'm certain the casting in 
unshare() is incorrect somehow. Is it simply to avoid signed overflow?

--
Added file: http://bugs.python.org/file36004/cow2.patch

___
Python tracker 

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



[issue15376] Refactor the test_runpy walk_package support code into a common location

2014-07-20 Thread Mark Lawrence

Mark Lawrence added the comment:

The chain of dependencies goes from here to #15403, #18576 and back here.  How 
do we break this loop?

--
nosy: +BreamoreBoy
type:  -> enhancement
versions: +Python 3.5 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue22017] Bad reference counting in the _warnings module

2014-07-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> The same kind of fix should also be applied to '_once_registry' and 
> '_filters'.

Oops, no they are correctly refcounted.

--

___
Python tracker 

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



[issue22017] Bad reference counting in the _warnings module

2014-07-20 Thread Xavier de Gaye

New submission from Xavier de Gaye:

$ ./python
Python 2.7.8+ (2.7:5563f895b215, Jul 20 2014, 18:10:28) 
[GCC 4.9.0 20140521 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.defaultaction = 'default'
>>> warnings.warn('some warning')
__main__:1: UserWarning: some warning
>>> exit()
Fatal Python error: Objects/dictobject.c:519 object at 0x7fce2013e2e0 has 
negative ref count -2604246222170760230
Aborted (core dumped)

The following patch fixes this: the new string object is referenced both by the 
static variable '_default_action' and the module attribute 'default_action'.
Python 3.5 handles this correctly.
The same kind of fix should also be applied to '_once_registry' and '_filters'.

diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -903,6 +903,7 @@
 return;
 
 _default_action = PyString_FromString("default");
+Py_INCREF(_default_action);
 if (_default_action == NULL)
 return;
 if (PyModule_AddObject(m, "default_action", _default_action) < 0)

--
components: Interpreter Core
messages: 223519
nosy: xdegaye
priority: normal
severity: normal
status: open
title: Bad reference counting in the _warnings module
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue21965] Add support for Memory BIO to _ssl

2014-07-20 Thread Geert Jansen

Geert Jansen added the comment:

Hi all (pitrou, haypo and all others) can I get some feedback on this patch?

Thanks!

--

___
Python tracker 

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



[issue22002] Make full use of test discovery in test subpackages

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

I have no problem with the change to test_email.  (I could have sworn I tried 
unittest.main() in __main__ when I set it up, but I must have screwed something 
up).

I didn't go over the patch line by line, but it looks good to me.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue22001] containers "same" does not always mean "__eq__".

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

"must be identical" sounds like "identical twins".  I think what you mean is 
"must be references to the same object or to objects that compare equal".  If 
you don't want to get into the concept of 'references' here, I suppose it could 
read "must be the same object or objects that compare equal".  What I'm saying 
is that "same object" is stronger than "identical"..."identical" is much closer 
to "equal" in English.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2014-07-20 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I've tried building the docs, but it appears to rely on a local build of Python 
as well as subversion, neither of which my system can do currently, so I'm 
hoping someone has a suitable environment to help test the building of the docs.

--

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2014-07-20 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I've made another commit to capture Steven's recommendations. I've also merged 
the work with the latest 2.7 tip, the result of which is the latest diff. I'll 
commit this in a week or two if there aren't any objections, though I would 
appreciate a review and especially any suggestions on how I might test the 
correctness of the syntax.

--

___
Python tracker 

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



[issue22000] cross type comparisons clarification

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

'type' and 'class' are two different names for the same concept in python3, so 
this paragraph simply appears to be out of date and indeed in need of complete 
rewording.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue21999] shlex: bug in posix mode handling of empty strings

2014-07-20 Thread R. David Murray

R. David Murray added the comment:

Vinay has a patch improving shlex parsing in issue 1521950, but it doesn't seem 
to address this case, so I'm adding him as nosy.

--
nosy: +r.david.murray, vinay.sajip
stage:  -> needs patch
title: shlex: bug in posix more handling of empty strings -> shlex: bug in 
posix mode handling of empty strings
type:  -> behavior
versions:  -Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2014-07-20 Thread Jason R. Coombs

Changes by Jason R. Coombs :


Added file: http://bugs.python.org/file36003/b8c09b766e20.diff

___
Python tracker 

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



[issue13540] Document the Action API in argparse

2014-07-20 Thread Jason R. Coombs

Changes by Jason R. Coombs :


Added file: http://bugs.python.org/file36001/9ac347a7f375.diff

___
Python tracker 

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



[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX

2014-07-20 Thread Ronald Oussoren

Ronald Oussoren added the comment:

> On 20 jul. 2014, at 10:32, Mark Dickinson  wrote:
> 
> 
> Mark Dickinson added the comment:
> 
>> In practice, I doubt that Python's going to meet such platforms in a hurry.
> 
> Hrm; looks like that's not a particularly safe assumption, especially with 
> older compilers that might do a "typedef int _Bool"

I'm not sure about the actual definition, but at least for OSX on PPC 
sizeof(bool) is not 1. I ran into this with pyobjc when I tried to treat BOOL 
and bool the same.

All of this is with Objective-C, but the same should be true for plain C.

--
title: struct.unpack('?', '\x02') returns (False,) when Python is built with 
clang -> struct.unpack('?', '\x02') returns (False,) on Mac OSX

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I have a hard time understanding what it would bring in Python's context. Even 
the Java API doesn't look very useful.

--
nosy: +neologix, pitrou

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +tim.peters

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2014-07-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Thanks Drekin - I'll point folks to your project as a good place to provide 
initial feedback, and if that seems promising we can look at potentially 
integrating the various fixes into Python 3.5

--

___
Python tracker 

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



[issue22016] Add a new 'surrogatereplace' output only error handler

2014-07-20 Thread Nick Coghlan

New submission from Nick Coghlan:

This would be along the same lines as xmlcharrefreplace and backslashreplace, 
but only affect surrogate escaped characters.

Unlike surrogate escape, which reproduces the escaped characters directly in 
the data stream, this would follow the 'replace' error handler and insert an 
appropriately encoded '?' character in the output stream.

The use case would be any context where losing the escaped characters is 
preferred to either potentially injecting arbitrary binary data into the output 
(surrogateescape), failing with an exception (strict), or any of the other 
existing codecs.

It would differ from 'replace' in that normal code points that can't be encoded 
at all would still trigger an error.

--
components: Interpreter Core, Library (Lib)
messages: 223508
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Add a new 'surrogatereplace' output only error handler
versions: Python 3.5

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2014-07-20 Thread Drekin

Drekin added the comment:

@Victor Stinner: You are right. So I did it. Here are the links to GitHub and 
PyPI: https://github.com/Drekin/win-unicode-console, 
https://pypi.python.org/pypi/win_unicode_console.

I also tried to delete the files, but it seems that it is only possible to 
unlink a file from the issue, but the file itself remains. Is it possible to 
manage the files?

--

___
Python tracker 

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



[issue21997] Pdb.set_trace debugging does not end correctly

2014-07-20 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> # This returns to a '>>>' prompt,

At the above line in Terry test, the debugger is not terminated and on linux 
when I type  at this point I get:

>>>
--Call--
> /home/xavier/etc/.pystartup(21)save_history()
-> def save_history(historyPath=historyPath):
(Pdb)

So this seems to be demonstrating the same problem as a).

The NameError exception (name 'run' is not defined) is caused by the execution 
of its def statement having been interrupted by the debugger with BdbQuit.

This issue could be kept open so as to include the "exec('do()', locals())" 
with the test cases when fixing the problem of Pdb termination.

--

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2014-07-20 Thread Drekin

Changes by Drekin :


Removed file: http://bugs.python.org/file27245/win_unicode_console.py

___
Python tracker 

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



[issue22015] C signal handler doesn't save/restore errno

2014-07-20 Thread STINNER Victor

STINNER Victor added the comment:

Ooops, I looked at the wrong function. signal_handler() saves/restores errno. 
trip_signal() is a function called by signal_handler(). The code is correct.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue22015] C signal handler doesn't save/restore errno

2014-07-20 Thread STINNER Victor

New submission from STINNER Victor:

The signal module has a wakefd feature which calls write(fd) in a signal 
handler, but the signal handler replaces errno without saving/restoring it.

See "Practice 4" in this article:
http://www.ibm.com/developerworks/linux/library/l-reent/index.html

Attached patch fixes the issue for Python 3.5. The bug should be fixed in 
Python 2.7, 3.4 and 3.5.

--
files: signal_errno.patch
keywords: patch
messages: 223504
nosy: haypo, neologix, pitrou
priority: normal
severity: normal
status: open
title: C signal handler doesn't save/restore errno
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36000/signal_errno.patch

___
Python tracker 

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



[issue22012] struct.unpack('?', '\x02') returns (False, ) when Python is built with clang

2014-07-20 Thread Ned Deily

Changes by Ned Deily :


--
title: struct.unpack('?', '\x02') returns (False,) on Mac OSX -> 
struct.unpack('?', '\x02') returns (False,) when Python is built with clang

___
Python tracker 

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



[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX

2014-07-20 Thread Mark Dickinson

Mark Dickinson added the comment:

> In practice, I doubt that Python's going to meet such platforms in a hurry.

Hrm; looks like that's not a particularly safe assumption, especially with 
older compilers that might do a "typedef int _Bool".

>From http://msdn.microsoft.com/en-us/library/tf4dy80a.aspx:

"That means that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in 
Visual C++ 5.0 and later, the same call yields 1."

--

___
Python tracker 

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



[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX

2014-07-20 Thread Mark Dickinson

Mark Dickinson added the comment:

For native struct packing / unpacking, it's not even clear to me that this 
should be considered a bug (though for standard unpacking it definitely is):  
the primary use-case for native unpacking is unpacking a collection of bytes 
that was written (from Python, or C, or ...) on the same machine, and in that 
case we're only going to be unpacking 0s and 1s.

FWIW, the docs say: "Either 0 or 1 in the native or standard bool 
representation will be packed, and any non-zero value will be True when 
unpacking.", so for native packing either the docs or the code need to be fixed.

The simplest solution would be to replace `nu_bool` with something identical to 
`bu_bool`.  In theory that would break on any platform where "sizeof(_Bool)" is 
greater than 1.  In practice, I doubt that Python's going to meet such 
platforms in a hurry.

--

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
keywords: +patch
Added file: http://bugs.python.org/file35999/threadgroup.diff

___
Python tracker 

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



[issue22013] Add at least minimal support for thread groups

2014-07-20 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file35998/parallel_download_application.py

___
Python tracker 

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



[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX

2014-07-20 Thread Ronald Oussoren

Ronald Oussoren added the comment:

> On 19 jul. 2014, at 23:22, Mark Dickinson  wrote:
> 
> 
> Mark Dickinson added the comment:
> 
> The relevant piece of code in the struct module looks like this:
> 
> static PyObject *
> nu_bool(const char *p, const formatdef *f)
> {
>BOOL_TYPE x;
>memcpy((char *)&x, p, sizeof x);
>return PyBool_FromLong(x != 0);
> }
> 
> Is it possible that BOOL_TYPE is a bitfield of length 1, and that clang is 
> somehow making use of that fact?

I haven't found a definitive source yet, but it seems that the only valid 
values for _Bool, which BOOL_TYPE expands to, are 0 and 1.  Clang might make 
use of that restriction. 

Ronald

--
title: struct.unpack('?', '\x02') returns (False,) when Python is built with 
clang -> struct.unpack('?', '\x02') returns (False,) on Mac OSX

___
Python tracker 

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



[issue22014] Add summary table for OS exception <-> errno mapping

2014-07-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Another idea would be to include fragments of the ASCII art hierarchy 
throughout the doc, but that's trickier than it sounds, since we just use 
literalinclude to generate the current one.

--

___
Python tracker 

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



[issue22014] Add summary table for OS exception <-> errno mapping

2014-07-20 Thread Nick Coghlan

New submission from Nick Coghlan:

It would be handy if the main OS exception docs at 
https://docs.python.org/3/library/exceptions.html#os-exceptions included a 
summary table mapping between exception types and errno names, akin to the one 
in the original PEP 
(http://www.python.org/dev/peps/pep-3151/#new-exception-classes)

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 223499
nosy: docs@python, ncoghlan
priority: normal
severity: normal
status: open
title: Add summary table for OS exception <-> errno mapping
versions: Python 3.4, Python 3.5

___
Python tracker 

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