[issue9949] os.path.realpath on Windows does not follow symbolic links

2018-01-23 Thread Étienne Dupuis

Étienne Dupuis  added the comment:

Referenced here: 
https://stackoverflow.com/questions/4640/python-os-path-realpath-for-symlink-in-windows.

--
nosy: +Étienne Dupuis

___
Python tracker 

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



Re: python to C code generator

2018-01-23 Thread Steven D'Aprano
On Tue, 23 Jan 2018 17:43:18 +, bartc wrote:

> It wouldn't be a satisfactory way of writing C programs. So, although
> I'm not that big a fan of C syntax, it might be better to write C as C,
> and Python as Python, to avoid confusion.)

This.

The fundamental reality is that `a + b` means different things in C and 
Python. Even if you limit yourself to integers and not arbitrary values 
(fractions, lists, strings, etc) the semantics are different:

- in C, ints have a fixed number of bits and any addition which
  ends up out of range is undefined behaviour[1];

- while Python uses BigInts, overflow is impossible, and the
  only possible error is that you run out of memory and an
  exception is raised (although the addition can take an 
  indefinite long amount of time).


Often the difference doesn't matter... but when it does matter, it 
*really* matters.




[1] If anyone thinks that it is addition with overflow, you are wrong. 
Some C compilers *may* use overflow, but the language strictly defines it 
as undefined behaviour, so the compiler can equally choose to set your 
computer on fire[2] if it prefers.

https://blog.regehr.org/archives/213



[2] http://www.catb.org/jargon/html/H/HCF.html


-- 
Steve

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Guido van Rossum

Guido van Rossum  added the comment:

No. I just mailed Yury with an explanation.

--

___
Python tracker 

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



[issue32644] unittest.mock.call len() error

2018-01-23 Thread Snakevil

New submission from Snakevil :

In some testcase, an instance of unittest.mock.call was generated as:

call('solution', 'foo', {'__spots__': {}, '__event__': None, '__solution__': 
None})

The third argument is an instance of a derived component from dict.

In this issue, result of len() is 2 but not 3 as expected.

--
components: Tests
messages: 310565
nosy: snakevil
priority: normal
severity: normal
status: open
title: unittest.mock.call len() error
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Thanks for the summary, Yury! One quick note:

> Effectively, the previously merged origin-tracking API (the one with which we 
> replaced set_coroutine_wrapper) achieves the same goal.

I would say the two features are complementary. This feature (unawaited 
tracking) is cheap (a few % slowdown on microbenchmarks), and lets you find all 
the unawaited coroutine objects created in a given span of code. 
Origin-tracking is expensive (~3x slowdown on microbenchmarks with asyncio's 
default settings), and lets you take a coroutine object and map it back to the 
exact line of code where it was created. If you have both, then you can find 
all the coroutine objects and then find their exact origins.

In the testing use case, there are two problems with relying on the GC to issue 
warnings: (1) because of traceback frame capture, reference cycles, etc., 
currently "coroutine was never awaited" warnings often (usually?) get 
attributed to the wrong test. (And yeah, it's even worse on pypy.) (2) because 
it's just a warning, it's easy to miss entirely -- if you forget an 'await' you 
can easily get a test that passes because it never actually executed any code 
(!), and when the tests are green most people don't read the CI logs to check 
for warnings.

The idea of this feature is it's cheap enough for pytest-asyncio or trio to 
turn it on by default, and it makes the detection deterministic, so e.g. 
pytest-asyncio can reliably figure out which test caused the problem and mark 
it as FAILed. Then if it you also turn on origin-tracking, it can further 
narrow that down to the exact line in the test that caused the failure.

--

___
Python tracker 

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



[issue32635] test_crypt segfaults when using libxcrypt instead of libcrypt

2018-01-23 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Incidentally, why did this manifest as a segfault rather than a compilation 
error?

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32604] Expose the subinterpreters C-API in Python for testing use.

2018-01-23 Thread Eric Snow

Eric Snow  added the comment:

Sounds good, Ned.  Thanks for taking a look.  I should have everything finished 
up by Friday, so I'm hopeful for landing the change before the deadline.  I may 
have a few minor tweaks to make after that, but I'll discuss that with you 
before making any changes if that happens.

--

___
Python tracker 

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



[issue32643] Make Task._step, Task._wakeup and Future._schedule_callback methods private

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +5140
stage:  -> patch review

___
Python tracker 

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



[issue32643] Make Task._step, Task._wakeup and Future._schedule_callback methods private

2018-01-23 Thread Yury Selivanov

New submission from Yury Selivanov :

I propose to drop support for overloading Task._step, Task._wakeup, and 
Future._schedule_callbacks.

This makes the implementation easier for us to maintain and optimize. It also 
makes it easier for alternative asyncio event loops and interops with other 
async frameworks.

--
components: asyncio
messages: 310561
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Make Task._step, Task._wakeup and Future._schedule_callback methods 
private
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2018-01-23 Thread Chris Jerdonek

New submission from Chris Jerdonek :

This issue is to suggest enhancing sys.path to recognize path-like objects, per 
PEP 519.

I recently ran into an issue where a path was getting added to sys.path, but 
the corresponding imports weren't working as they should, even though sys.path 
showed the path as being present. Eventually I tracked this down to the path 
being a pathlib.Path object rather than a string. This wasn't obvious because 
Path objects appear as strings in normal debug output, etc.

The sys.path docs currently say this:

> Only strings and bytes should be added to sys.path; all other data types are 
> ignored during import.

--
components: Library (Lib)
messages: 310560
nosy: brett.cannon, chris.jerdonek
priority: normal
severity: normal
status: open
title: add support for path-like objects in sys.path
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

Guido,

This is another feature for native coroutines that Nathaniel proposes for 3.7.

Here's a summary (this issue has too many messages):

1. It adds a new mechanism to detect un-awaited coroutines (i.e. when a user 
forgets to use await).

2. To enable the mechanism, which is disabled by default, a "sys. 
set_unawaited_coroutine_tracking_enabled()" function needs to be called by a 
framework.

3. "sys.get_unawaited_coroutines()" returns a list of not-yet-awaited 
native-coroutine objects that were created since the previous call to 
"get_unawaited_coroutines()".

4. In Trio, the APIs are designed to accept *coroutine functions*.  So in Trio, 
a user either writes "await coro()" or passes "coro" to a Trio API.  Nathaniel 
wants Trio to check periodically if there are any un-awaited coroutines and 
raise an error, which should improve Trio usability.

5. Another potential user of this new functionality is pytest-asyncio. It can 
use the API to warn the user that a test created some coroutines that were 
never awaited. 

6. asyncio/tornado/curio/twisted will not be able to use this API.

7. Effectively, the previously merged origin-tracking API (the one with which 
we replaced set_coroutine_wrapper) achieves the same goal.  The only downside 
is that the warning won't be raised until GC.  On other interpreters like PyPy 
it can take a while before a coroutine gets GCed.

8. The patch adds two pointers to native coroutines objects to maintain a 
doubly-linked list of them.

9. The performance impact is visible in micro-benchmarks, but is unlikely be 
visible in real applications.  Still, it's about 3-4% slowdown for both 
generators and coroutines.

10. The PR itself is in a good shape, although I'll still make a review pass if 
you approve this feature to go in 3.7.

What do you think?

--

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yury also asked me to try running a generator/coroutine microbenchmark from PEP 
492 (https://www.python.org/dev/peps/pep-0492/#async-await). I'm attaching the 
actual script for that as well (pep492bench.py), since I had to add a few lines 
to actually run the functions in the PEP :-).

Results from 3 runs each of the two builds, alternating:

-

~/src/cpython$ without-unawaited-tracking/install/bin/python3 pep492bench.py 
binary(19) * 30: total 7.349s
abinary(19) * 30: total 7.727s
~/src/cpython$ with-unawaited-tracking/install/bin/python3 pep492bench.py 
binary(19) * 30: total 7.758s
abinary(19) * 30: total 8.023s
~/src/cpython$ without-unawaited-tracking/install/bin/python3 pep492bench.py
binary(19) * 30: total 7.326s
abinary(19) * 30: total 7.686s
~/src/cpython$ with-unawaited-tracking/install/bin/python3 pep492bench.py   
binary(19) * 30: total 7.652s
abinary(19) * 30: total 7.999s
~/src/cpython$ without-unawaited-tracking/install/bin/python3 pep492bench.py
binary(19) * 30: total 7.421s
abinary(19) * 30: total 7.732s
~/src/cpython$ with-unawaited-tracking/install/bin/python3 pep492bench.py   
binary(19) * 30: total 7.541s
abinary(19) * 30: total 8.132s

-

So here we get a small difference between the with-unawaited-tracking and the 
without-unawaited-tracking builds. For generators, with-unawaited-tracking is:

In [1]: (7.541 + 7.652 + 7.758) / (7.349 + 7.326 + 7.421)
Out[1]: 1.0386947863866764

~3.9% slower.

And for coroutines, with-unawaited-tracking is:

In [2]: (8.023 + 7.999 + 8.132) / (7.727 + 7.686 + 7.732)
Out[2]: 1.043594728883128

~4.4% slower.

--
Added file: https://bugs.python.org/file47406/pep492bench.py

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Please insert the usual caveats around how reliable benchmarking is impossible. 
(Last month when I tried this with a previous version of the patch, the 
interpreter that had the patch applied -- and thus was doing slightly *more* 
work -- was consistently a few percent faster in general, because something 
something PGO I guess? Compilers are weird.)

That said, I'm not seeing any measurable difference at all with this patch. 
This isn't surprising: in the default mode (tracking disabled), the extra 
operations are:

coroutine creation: 'if (predictably_true) { self->a = NULL; self->b = NULL }'

send/throw: 'if (genobject->ob_type == PyCoro_Type && self->a != NULL) { /* not 
executed, because the condition always fails */ }'

- benchmark details

I built 3954f6126f (head of my PR branch, labeled "with-unawaited-coroutines" 
below) and f23746a934 (its immediate parent, on master, labeled 
"without-unawaited-coroutines" below), with --enable-optimizations, on a 
Thinkpad T450s running 64-bit Linux. I ran a script (included below) that 
simply created and executed a trivial coroutine over and over, and measured 
using perf.

2 runs of each, alternating:

~/src/cpython$ without-unawaited-tracking/install/bin/python3 corobench.py
.
coroutine creation/close: Mean +- std dev: 3.90 us +- 0.11 us
~/src/cpython$ with-unawaited-tracking/install/bin/python3 corobench.py   
.
coroutine creation/close: Mean +- std dev: 3.90 us +- 0.09 us
~/src/cpython$ without-unawaited-tracking/install/bin/python3 corobench.py
.
coroutine creation/close: Mean +- std dev: 3.93 us +- 0.21 us
~/src/cpython$ with-unawaited-tracking/install/bin/python3 corobench.py   
.
coroutine creation/close: Mean +- std dev: 3.91 us +- 0.10 us


Script: attached as "corobench.py"

--
Added file: https://bugs.python.org/file47405/corobench.py

___
Python tracker 

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



Re: Why is there no functional xml?

2018-01-23 Thread Rustom Mody
On Tuesday, January 23, 2018 at 8:23:43 PM UTC+5:30, Peter Otten wrote:
> Rustom Mody wrote:
> > [I find the OO/imperative style of making a half-done node and then
> > [throwing
> > piece-by-piece of contents in/at it highly aggravating]
> 
> What I meant is that once you throw a bit of introspection at it much of the 
> tedium vanishes. Here's what might become of the DOM-creation as part of an 
> actual script:


«snipped named-tuple magic»

> To generalize that to handle arbitrarily nested lists and namedtuples a bit 
> more effort is needed, but I can't see where lxml.objectify could make that 
> much easier.

You really mean that??
Well sure in the programming world and even more so in the python world
“Flat is better than nested” is a maxim

But equally programmers need to satisfy requirements…

And right now I am seeing things like this
---
http://schemas.xmlsoap.org/soap/envelope/;>

http://example.com/;>

  
AGGREGATION_ANALYSIS
  
  

  
  

  
  



  
  

  «Big base64 blob»

  





---
Thats 7 levels of nesting (assuming I can count right!)


Speaking of which another followup question:


With
# Read above xml
>>> with open('soap_response.xml') as f: inp = etree.parse(f)
# namespace dict
>>> nsd = {'soap': "http://schemas.xmlsoap.org/soap/envelope/;, 'locns': 
>>> "http://example.com/"}

The following behavior is observed — actual responses elided in the interest of
brevity

>>> inp.xpath('//soap:Body', namespaces = nsd)
finds/reaches the node

>>> inp.xpath('//locns:blobRetrieveResponse', namespaces = nsd)
finds

>>> inp.xpath('//locns:dtCreationDate', namespaces = nsd)
does not find

>>> inp.xpath('//dtCreationDate', namespaces = nsd)
finds

>>> inp.xpath('//dtCreationDate')
also finds


Doesnt this contradict the fact that dtCreationDate is under the locns 
namespace??

Any explanations??
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32513] dataclasses: make it easier to use user-supplied special methods

2018-01-23 Thread Guido van Rossum

Guido van Rossum  added the comment:

Are we clear on the proposal now? It would be good to have this implemented in 
beta 1. Eric's long message looks good to me (though I have to admit the logic 
around __hash__ confuses me, but I've spent two long days at PyCascades, and I 
trust Eric's judgment).

--
nosy: +gvanrossum

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset b7a80d543e1e94475ab9c8214f7a9eab4e63c9ab by Yury Selivanov in 
branch 'master':
bpo-32436: Don't use native popcount() (also fixes bpo-32641) (#5292)
https://github.com/python/cpython/commit/b7a80d543e1e94475ab9c8214f7a9eab4e63c9ab


--
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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

I've pushed a commit that should fix the buildbot. Please reopen if it doesn't.

--

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset b7a80d543e1e94475ab9c8214f7a9eab4e63c9ab by Yury Selivanov in 
branch 'master':
bpo-32436: Don't use native popcount() (also fixes bpo-32641) (#5292)
https://github.com/python/cpython/commit/b7a80d543e1e94475ab9c8214f7a9eab4e63c9ab


--

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

In an off-list conversation with David, it was confirmed that the buildbot in 
question runs on an old hardware without SSE4.2 support.

I decided to simply stop using native popcount instructions as there's no 
detectable performance difference when using them vs using the fallback code.

See https://github.com/python/cpython/pull/5292 for details.

--
stage: patch review -> 

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +5139
stage:  -> patch review

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +5138
stage: commit review -> patch review

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Change by Nathaniel Smith :


--
keywords: +patch
pull_requests: +5137
stage:  -> patch review

___
Python tracker 

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



[issue32502] uuid1() fails if only 64-bit interface addresses are available

2018-01-23 Thread bbayles

Change by bbayles :


--
pull_requests: +5136

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Ah-hah, I get what's going on.

@asyncio.coroutine has always been buggy: when debug mode is turned on, then it 
fails to set CO_ITERABLE_COROUTINE.

However, when debug mode is turned on, then traditionally native coroutines got 
wrapped into CoroWrapper objects. We've always been lazy and reused the same 
CoroWrapper type for both native coroutines and old-style @asyncio.coroutine 
coroutines, so CoroWrapper has both coroutine and generator attributes.

This means that until my patch, in debug mode, native coroutines were *getting 
turned back into generators*. So this hid the bug in @asyncio.coroutine, 
because it doesn't matter if you can't call native coroutines if you've just 
turned them into generators.

The fix is trivial, we just need to always use @types.coroutine in 
@asyncio.coroutine, I'll put up a PR momentarily.

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

No, it's this specific commit.  I can double check later, but I'm pretty sure 
about that.

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

How confident are we that this is a regression from the coroutine origin 
tracking changes? (I'd double-check myself, but my cpython checkout is tied up 
for the next few hours doing --enable-optimizations builds.)

Looking at @asyncio.coroutine, in particular this branch that gets taken when 
debug mode is enabled:

https://github.com/python/cpython/blob/6b273f7f4056f8276f61a97c789d6bb4425e653c/Lib/asyncio/coroutines.py#L135-L149

I'm not seeing anything that would toggle the CO_ITERABLE_COROUTINE flag, and 
if I use pdb I can see that in the broken test the 'sleeper' function indeed 
doesn't have that flag set. But I didn't touch that code in the origin tracking 
patch, which makes me think that the proximal cause here might have been 
5f841b553814969220b096a2b4f959b7f6fcbaf6 ?

--

___
Python tracker 

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



[issue32623] Resize dict on del/pop

2018-01-23 Thread INADA Naoki

INADA Naoki  added the comment:

For insert/pop loop, reduce table size aggressively on pop may cause
performance regression.  So reducing size should be conservative.

So my opinion is:

* When dict size become 0, make the dict shared-empty, like dict.clear()
* When (dict size < dk_size/8), call insertion_resize()

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

asyncio.coroutine sets the co_flags bit CO_ITERABLE_COROUTINE for generator 
functions' code objects.

With that bit flag, Python allows to 'yield from' native coroutines.

CoroWrapper.send() -> wrapped_generator.send() -> YIELD_FROM(native_coro) -> 
native_coro.send()

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

(However, I can report that at least that particular test starts working again 
if I convert 'sleeper' into an 'async def' coroutine.)

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Question: there are lots of tests -- for example 
test.test_asyncio.test_tasks.CTaskSubclass_PyFuture_Tests.test_wait_with_exception,
 which freezes for me -- that use 'yield from asyncio.sleep(...)', e.g.:

@asyncio.coroutine
def sleeper():
yield from asyncio.sleep(0.15, loop=loop)
raise ZeroDivisionError('really')

But Andrew switch asyncio.sleep to be an ordinary 'async def' coroutine back in 
December. How does this work at all?

My tentative hypothesis about the actual bug is that the code above is working 
in regular mode, but stops working in debug mode, probably because in debug 
mode @asyncio.coroutine takes a different path involving CoroWrapper and we 
changed CoroWrapper. But I'm having trouble knowing how to verify or fix that 
because I don't understand how it ever works in the first place :-)

--

___
Python tracker 

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



Re: Processing a key pressed in Python 3.6

2018-01-23 Thread Virgil Stokes

Ok Dennis,

You were correct. The following also works in the Windows 10 command window.


import time
import msvcrt

while "more work to do":
    print("Getting data...")
    time.sleep(1)
    print("Saving data to file...")
    time.sleep(1)
    key = msvcrt.getwch()
    #print('key: %s'%key)  # just to show the result
    if key == chr(27):
    print("Pre-termination...")
    time.sleep(1)
    raise SystemExit("exit") 
Note, I am using the "Esc" key to exit, which is one answer to my last 
posting on this topic.



On 2018-01-23 20:37, Dennis Lee Bieber wrote:

On Tue, 23 Jan 2018 19:50:57 +0100, Virgil Stokes  declaimed
the following:


I am running the code with Python 3.6 on a windows 10 platform. I have
tried many approaches (mainly those posted on stackoverflow) but I have
yet to find an approach that works for this structure.

Note:
   1) The code is executed in the windows 10 command window
   2) I am not using wxPython, IDLE, or pyGame in this application.
   3) The time to get the data, process it and write it to a file can
  take from 0.5 sec to 1.5 sec
   4) The key hit need not be echoed to the command window

And none of your searching found
https://docs.python.org/3/library/msvcrt.html
which is part of the standard library (and documented in the library
manual). The module IS Windows specific, you'd have to rewrite the code to
run on Linux.

Now, if your requirement was to detect a keypress WHILE the data
fetch/processing was happening, the solution will be different.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Processing a key pressed in Python 3.6

2018-01-23 Thread MRAB

On 2018-01-23 23:29, Virgil Stokes wrote:

Another follow-up question:

How would this code be modified to handle using the "Esc" key instead of
the "Enter" key?


This version uses msvcrt on Windows:

import msvcrt
import threading
import time

shutdown = False

def wait_for_enter():
global shutdown

print("Hit Enter to quit.")
# b'\x0D' is the bytestring produced by the Enter key.
# b'\x1B' is the bytestring produced by the Esc key.
if msvcrt.getch() == b'\x1B':
shutdown = True

threading.Thread(target=wait_for_enter).start()

while "more work to do":
 print("Getting data...")
 time.sleep(1)
 print("Saving data to file...")
 time.sleep(1)

 if shutdown:
 print("Pre-termination...")
 time.sleep(1)
 raise SystemExit("exit")


Another function of note is "msvcrt.kbhit()", which will tell you if 
there's a key waiting to be read.


This is all in the docs for the msvcrt module.


On 2018-01-23 20:15, Chris Angelico wrote:

On Wed, Jan 24, 2018 at 5:50 AM, Virgil Stokes  wrote:

I would appreciate help on finding a solution to following problem. This is
the general structure of the "problem" code:


while True
 # Get some data from the web and process it
 ...
 ...
 # Write these data to a file
 ...
 ...
 # Check if a_key has been pressed in the command window
 ...
 ...
 if a_key_pressed:
 # Perform some pre-termination tasks
 ...
 ...
 # Close the output data file
 ...
 ...
 raise SystemExit('Exit')


I am running the code with Python 3.6 on a windows 10 platform. I have tried
many approaches (mainly those posted on stackoverflow) but I have yet to
find an approach that works for this structure.

Note:
   1) The code is executed in the windows 10 command window
   2) I am not using wxPython, IDLE, or pyGame in this application.
   3) The time to get the data, process it and write it to a file can
  take from 0.5 sec to 1.5 sec
   4) The key hit need not be echoed to the command window


Are you okay with demanding a specific key, rather than simply "press
any key"? Even better, key combination? Handle Ctrl-C by catching
KeyboardInterrupt and you can take advantage of Python's existing
cross-platform handling of the standard interrupt signal.

If Ctrl-C won't work for you, how about stipulating that it be Enter?
"Press Enter to quit" isn't too much worse than "Press any key to
quit" (plus you have less chance of accidentally terminating the
program when you don't want to). Spin off a thread to wait for enter.
I've tested this only on Linux, but it ought to work:

import threading
import time

shutdown = False
def wait_for_enter():
 print("Hit Enter to quit.")
 input()
 global shutdown; shutdown = True

threading.Thread(target=wait_for_enter).start()

while "more work to do":
 print("Getting data...")
 time.sleep(1)
 print("Saving data to file...")
 time.sleep(1)
 if shutdown:
 print("Pre-termination...")
 time.sleep(1)
 raise SystemExit("exit")

If it doesn't, try switching around which is the secondary thread and
which is the primary - spin off a thread to do the work, then call
input() in the main thread.

ChrisA




--
https://mail.python.org/mailman/listinfo/python-list


Re: Processing a key pressed in Python 3.6

2018-01-23 Thread eryk sun
On Tue, Jan 23, 2018 at 11:29 PM, Virgil Stokes  wrote:
>
> How would this code be modified to handle using the "Esc" key instead of the
> "Enter" key?

The input() function depends on the console or terminal to read a line
of input. If you're using the Windows console, it calls the high-level
ReadConsole (or ReadFile) function, which performs a 'cooked' read. In
this case some keys are reserved. Escape is consumed to clear/flush
the input buffer. Function keys and arrows are consumed for line
editing and history navigation. And for some reason line-feed (^J) is
always ignored. Additionally, normal operation requires the following
input modes to be enabled:

ENABLE_PROCESSED_INPUT
process Ctrl+C as CTRL_C_EVENT and carriage return (^M)
as carriage return plus line feed (CRLF). consume
backspace (^H) to delete the previous character.

ENABLE_LINE_INPUT
return only when a carriage return is read.

ENABLE_ECHO_INPUT
echo read characters to the active screen.

Reading the escape key from the console requires the low-level
ReadConsoleInput, GetNumberOfConsoleInputEvents, and
FlushConsoleInputBuffer functions. These access the console's raw
stream of input event records, which includes key events, mouse
events, and window/buffer resize events. It's a bit complicated to use
this API, but fortunately the C runtime wraps it with convenient
functions such as _kbhit, _getwch, and _getwche (w/ echo). On Windows
only, you'll find these functions in the msvcrt module, but named
without the leading underscore. Here's an example of reading the
escape character without echo:

>>> msvcrt.getwch()
'\x1b'

Simple, no?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32502] uuid1() fails if only 64-bit interface addresses are available

2018-01-23 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:


New changeset 6b273f7f4056f8276f61a97c789d6bb4425e653c by Barry Warsaw (Bo 
Bayles) in branch 'master':
bpo-32502: Discard 64-bit (and other invalid) hardware addresses (#5254)
https://github.com/python/cpython/commit/6b273f7f4056f8276f61a97c789d6bb4425e653c


--

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +yan12125

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

A similar change was proposed by pmp-p on MicroPython: 
https://github.com/micropython/micropython/pull/3564

His use case is to use ffi module on Android (see the PR for more information), 
currently ffi fails to locate libraries.

--

___
Python tracker 

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



[issue31000] Test failure in resource module on ZFS

2018-01-23 Thread Larry Hastings

Larry Hastings  added the comment:

I'm using ZFS on 64-bit Linux.

I did see a Github issue / commit that claims to address this.  I'm using a 
reasonably recent ZoL build, that should have that commit, and I still see the 
behavior.

I actually experimented with it a little, and, hmm.  The test sets the rlimit 
to 1024 bytes.  I can write exactly 512 bytes to the file; it fails on the 
513th.  We *could* change the test to behave like that (write 512 bytes, then 
write 513 more) but I don't think we should work around their bug.

--

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +doko

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

> I suspect this is a compiler bug.

It may be interesting to add the compiler version to test.pythoninfo. It would 
be simpler to compare Windows buildbots to identify a bug.

Currently, the only info is:

"sys.version: 3.7.0a4+ (heads/master:9d411c1, Jan 23 2018, 15:13:42) [MSC 
v.1900 32 bit (Intel)]"

Some environment variables are also dumped:

os.environ[VS100COMNTOOLS]: C:\Program Files\Microsoft Visual Studio 
10.0\Common7\Tools\
os.environ[VS140COMNTOOLS]: D:\Program Files\Microsoft Visual Studio 
14.0\Common7\Tools\
os.environ[VS90COMNTOOLS]: D:\Program Files\Microsoft Visual Studio 
9.0\Common7\Tools\

In the compile step, I see lines like:

"Microsoft (R) Build Engine version 14.0.24730.2"

I recall also issues with outdated ucrtbase DLLs. Maybe we can also dump the 
version of such DLL?

--

___
Python tracker 

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



[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2018-01-23 Thread paul j3

paul j3  added the comment:

I attached a script that implements Evan's _match_argument idea, using a 
ArgumentParser subclass.  I think this is the safest way to add different 
functionality to the parser.  It (subclassing) is used, for example in pypi 
extensions like plac.

My version places the special nargs case after the default match test.  So it 
acts only if the regular action fails.  But I don't know of a test case where 
that difference matters.

I've tested it with all the examples posted in this issue, but have not tested 
it against test_argparse.py.  I'd also like to know if it goes far enough in 
adapting to optparse/POSIX usage.  It probably doesn't.

--
Added file: https://bugs.python.org/file47404/argparse_opt.py

___
Python tracker 

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



[issue28046] Remove the concept of platform-specific directories

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

The cleanup is not complete, so I reopen the issue: 
https://github.com/python/cpython/pull/5289

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

___
Python tracker 

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



[issue28046] Remove the concept of platform-specific directories

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +5135

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +db3l

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

I suspect this is a compiler bug.  I can't reproduce it on my windows 7 virtual 
machine and on AppVeyor.

It's not related to HAMT, btw, as there is a multitude of HAMT-specific tests 
that all pass.  The crash is specifically in context.c, and the code there is 
pretty trivial.

--

___
Python tracker 

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



Re: plot / graph connecting re ordered lists

2018-01-23 Thread duncan smith
On 23/01/18 23:42, Vincent Davis wrote:
> On Tue, Jan 23, 2018 at 4:15 PM Dennis Lee Bieber 
> wrote:
> 
>> On Tue, 23 Jan 2018 13:51:55 -0700, Vincent Davis
>>  declaimed the following:
>>
>>> Looking for suggestions. I have an ordered list of names these names will
>>> be reordered. I am looking to make a plot, graph, with the two origins of
>>
>> IE: you have two lists with the same items in different orders...
>>
>>> the names in separate columns and a line connecting them to visually
>>> represent how much they have moved in the reordering.
>>> Surely there is some great example code for this on the net an am not
>>> finding a clean example.
>>>
>>
>> Determine positions:
>>
>> pos = []
>> for p, name in enumerate(first_list):
>> np = second_list.index(name)
>> pos.append( (name, p, np) )
>>
>> for (name, p, np) in pos:
>> draw_line((1,p) , (2, np))
>> label( (1, p), name)
>>
>> Exact details of graphics package and scaling left as an exercise
> 
> 
> Actualy, it’s recomendations for a graphing package And an example using it
> for such a graph that I am most interested in. I know how to relate the
> names on the 2 lists.
> 
> 
>> --
>> Wulfraed Dennis Lee Bieber AF6VN
>> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>

Maybe http://graphviz.org/ and http://matthiaseisen.com/articles/graphviz/

Duncan
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

The idea was first discussed on python-dev:

https://mail.python.org/pipermail/python-dev/2018-January/151874.html

me: "It seems like sys.platform == 'android' would be more appropriate
since Android is not Linux: different libc, different filesystems,
etc."

https://mail.python.org/pipermail/python-dev/2018-January/151887.html

Brett Cannon: "I've had a similar thought myself.".

--

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +5134

___
Python tracker 

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



[issue32551] Zipfile & directory execution in 3.5.4 also adds the parent directory to sys.path

2018-01-23 Thread Ned Batchelder

Ned Batchelder  added the comment:

I can confirm that 3.5.5rc1 fixes the problem I had.

--

___
Python tracker 

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



Re: plot / graph connecting re ordered lists

2018-01-23 Thread Vincent Davis
On Tue, Jan 23, 2018 at 4:15 PM Dennis Lee Bieber 
wrote:

> On Tue, 23 Jan 2018 13:51:55 -0700, Vincent Davis
>  declaimed the following:
>
> >Looking for suggestions. I have an ordered list of names these names will
> >be reordered. I am looking to make a plot, graph, with the two origins of
>
> IE: you have two lists with the same items in different orders...
>
> >the names in separate columns and a line connecting them to visually
> >represent how much they have moved in the reordering.
> >Surely there is some great example code for this on the net an am not
> >finding a clean example.
> >
>
> Determine positions:
>
> pos = []
> for p, name in enumerate(first_list):
> np = second_list.index(name)
> pos.append( (name, p, np) )
>
> for (name, p, np) in pos:
> draw_line((1,p) , (2, np))
> label( (1, p), name)
>
> Exact details of graphics package and scaling left as an exercise


Actualy, it’s recomendations for a graphing package And an example using it
for such a graph that I am most interested in. I know how to relate the
names on the 2 lists.


> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Sent from mobile app. Vincent Davis 720-301-3003
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Processing a key pressed in Python 3.6

2018-01-23 Thread Virgil Stokes

Another follow-up question:

How would this code be modified to handle using the "Esc" key instead of 
the "Enter" key?



On 2018-01-23 20:15, Chris Angelico wrote:

On Wed, Jan 24, 2018 at 5:50 AM, Virgil Stokes  wrote:

I would appreciate help on finding a solution to following problem. This is
the general structure of the "problem" code:


while True
 # Get some data from the web and process it
 ...
 ...
 # Write these data to a file
 ...
 ...
 # Check if a_key has been pressed in the command window
 ...
 ...
 if a_key_pressed:
 # Perform some pre-termination tasks
 ...
 ...
 # Close the output data file
 ...
 ...
 raise SystemExit('Exit')


I am running the code with Python 3.6 on a windows 10 platform. I have tried
many approaches (mainly those posted on stackoverflow) but I have yet to
find an approach that works for this structure.

Note:
   1) The code is executed in the windows 10 command window
   2) I am not using wxPython, IDLE, or pyGame in this application.
   3) The time to get the data, process it and write it to a file can
  take from 0.5 sec to 1.5 sec
   4) The key hit need not be echoed to the command window


Are you okay with demanding a specific key, rather than simply "press
any key"? Even better, key combination? Handle Ctrl-C by catching
KeyboardInterrupt and you can take advantage of Python's existing
cross-platform handling of the standard interrupt signal.

If Ctrl-C won't work for you, how about stipulating that it be Enter?
"Press Enter to quit" isn't too much worse than "Press any key to
quit" (plus you have less chance of accidentally terminating the
program when you don't want to). Spin off a thread to wait for enter.
I've tested this only on Linux, but it ought to work:

import threading
import time

shutdown = False
def wait_for_enter():
 print("Hit Enter to quit.")
 input()
 global shutdown; shutdown = True

threading.Thread(target=wait_for_enter).start()

while "more work to do":
 print("Getting data...")
 time.sleep(1)
 print("Saving data to file...")
 time.sleep(1)
 if shutdown:
 print("Pre-termination...")
 time.sleep(1)
 raise SystemExit("exit")

If it doesn't, try switching around which is the secondary thread and
which is the primary - spin off a thread to do the work, then call
input() in the main thread.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


[issue22946] urllib gives incorrect url after open when using HTTPS

2018-01-23 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

@John.McKay, would you be interested in converting your patch to a Github pull 
request on the master branch?

--
nosy: +csabella
versions: +Python 3.7 -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



[issue32640] Python 2.7 str.join documentation is incorrect

2018-01-23 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Looks like this happened in PR1898.

--
nosy: +Mariatta, csabella
stage:  -> needs patch

___
Python tracker 

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



[issue20709] os.utime(path_to_directory): wrong documentation for Windows.

2018-01-23 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

@jgehrcke, would you be able to convert your patch to a Github pull request on 
the master branch?

--
nosy: +csabella
stage:  -> needs patch
versions: +Python 3.7 -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

No, these are trivial uint32_t/Py_SIZE: `for (uint32_t i = val_idx + 1; i < 
Py_SIZE(o); i++)`; it's something else.  I suspect popcount instruction...

--

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

Some hints. Compiler warnings:

..\Python\hamt.c(625): warning C4018: '<': signed/unsigned mismatch 
[D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\PCbuild\pythoncore.vcxproj]
..\Python\hamt.c(733): warning C4018: '<': signed/unsigned mismatch 
[D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\PCbuild\pythoncore.vcxproj]
..\Python\hamt.c(939): warning C4018: '<': signed/unsigned mismatch 
[D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\PCbuild\pythoncore.vcxproj]
..\Python\hamt.c(1122): warning C4018: '<': signed/unsigned mismatch 
[D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\PCbuild\pythoncore.vcxproj]

--

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

It's not a regression, the newly added code doesn't work on some Windows 
buildbot... looking at it.

--

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

test_asyncio started to crash at build 491:

http://buildbot.python.org/all/#/builders/58/builds/491

This build contains the commit f23746a934177c48eff754411aba54c31d6be2f0: 
"bpo-32436: Implement PEP 567". I'm not 100% sure that it's the cause of the 
regression. Since test_context added by this commit also crash, it really 
smells this the cause of the regression.

--

___
Python tracker 

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



[issue32641] test_context and test_asyncio crash on Windows 7

2018-01-23 Thread STINNER Victor

New submission from STINNER Victor :

http://buildbot.python.org/all/#/builders/58/builds/498

0:36:25 [252/414/1] test_context crashed (Exit code 3) -- running: 
test_largefile (239 sec)
Windows fatal exception: code 0xc01d

Current thread 0x0944 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_context.py",
 line 321 in ctx1_fun
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_context.py",
 line 339 in test_context_copy_1
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 615 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 663 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\runner.py",
 line 176 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1861 in _run_suite
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1951 in run_unittest
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 175 in test_runner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 176 in runtest_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 130 in runtest
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest_mp.py",
 line 67 in run_tests_slave
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 517 in _main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 510 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 585 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\regrtest.py", 
line 46 in _main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\regrtest.py", 
line 50 in 
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\runpy.py", 
line 85 in _run_code
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\runpy.py", 
line 193 in _run_module_as_main
Fatal Python error: Illegal instruction

Current thread 0x0944 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_context.py",
 line 321 in ctx1_fun
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_context.py",
 line 339 in test_context_copy_1
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 615 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 663 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\runner.py",
 line 176 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1861 in _run_suite
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1951 in run_unittest
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 175 in test_runner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 176 in runtest_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 130 in runtest
  File 

[issue32639] Coverity: CID 1428443: Null pointer dereferences (NULL_RETURNS) /Python/hamt.c: 1058 in hamt_node_bitmap_without()

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Oh, I didn't know. The current workflow is not ideal to avoid duplicated 
> issues.

If I fix something that's been reported there I usually update the coverity 
issue directly.  But yeah...

--

___
Python tracker 

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



[issue32639] Coverity: CID 1428443: Null pointer dereferences (NULL_RETURNS) /Python/hamt.c: 1058 in hamt_node_bitmap_without()

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

> (I also receive coverity reports :)

Oh, I didn't know. The current workflow is not ideal to avoid duplicated issues.

--
title: Coverity: CID 1428443:  Null pointer dereferences  (NULL_RETURNS) 
/Python/hamt.c: 1058 in hamt_node_bitmap_without() -> Coverity: CID 1428443: 
Null pointer dereferences (NULL_RETURNS) /Python/hamt.c: 1058 in 
hamt_node_bitmap_without()

___
Python tracker 

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



[issue32640] Python 2.7 str.join documentation is incorrect

2018-01-23 Thread Malcolm Smith

New submission from Malcolm Smith :

At some point the Python 3 documentation of str.join has been copied to Python 
2. This includes the sentence "A TypeError will be raised if there are any 
non-string values in iterable, including bytes objects." 

The second half of this sentence is wrong for Python 2. Not only is there no 
"bytes" type in Python 2, but join() in this version will happily join any 
mixture of unicode and (byte-)str objects, producing unicode output if any of 
the items (or separator) were unicode.

https://docs.python.org/2/library/stdtypes.html#str.join

--
assignee: docs@python
components: Documentation
messages: 310525
nosy: Malcolm Smith, docs@python
priority: normal
severity: normal
status: open
title: Python 2.7 str.join documentation is incorrect
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



[issue32639] Coverity: CID 1428443: Null pointer dereferences (NULL_RETURNS) /Python/hamt.c: 1058 in hamt_node_bitmap_without()

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

Victor, it's been already fixed/tracked here: 
https://github.com/python/cpython/pull/5286

(I also receive coverity reports :)

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 0bad4d63c654d93e1f32ff35026405a3987db5ca by Yury Selivanov in 
branch 'master':
bpo-32436: Fix potential NULL dereference (#5286)
https://github.com/python/cpython/commit/0bad4d63c654d93e1f32ff35026405a3987db5ca


--

___
Python tracker 

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



[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +5133
stage:  -> patch review

___
Python tracker 

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



[issue32639] Coverity: CID 1428443: Null pointer dereferences (NULL_RETURNS) /Python/hamt.c: 1058 in hamt_node_bitmap_without()

2018-01-23 Thread STINNER Victor

New submission from STINNER Victor :

Coverity found a bug in hamt.c:

** CID 1428443:  Null pointer dereferences  (NULL_RETURNS)
/Python/hamt.c: 1058 in hamt_node_bitmap_without()



*** CID 1428443:  Null pointer dereferences  (NULL_RETURNS)
/Python/hamt.c: 1058 in hamt_node_bitmap_without()
1052 assert(hamt_node_collision_count(
1053 (PyHamtNode_Collision*)sub_node) > 1);
1054 }
1055 #endif
1056
1057 PyHamtNode_Bitmap *clone = 
hamt_node_bitmap_clone(self);
>>> CID 1428443:  Null pointer dereferences  (NULL_RETURNS)
>>> Dereferencing a null pointer "clone".
1058 Py_SETREF(clone->b_array[val_idx],
1059   (PyObject *)sub_node);  /* borrow */
1060
1061 *new_node = (PyHamtNode *)clone;
1062 return W_NEWNODE;
1063 }

--
components: Interpreter Core
messages: 310522
nosy: vstinner, yselivanov
priority: normal
severity: normal
status: open
title: Coverity: CID 1428443:  Null pointer dereferences  (NULL_RETURNS) 
/Python/hamt.c: 1058 in hamt_node_bitmap_without()
versions: Python 3.7

___
Python tracker 

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



[issue32202] [ctypes] all long double tests fail on android-24-x86_64

2018-01-23 Thread pmpp

Change by pmpp :


--
nosy: +pmpp

___
Python tracker 

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



plot / graph connecting re ordered lists

2018-01-23 Thread Vincent Davis
Looking for suggestions. I have an ordered list of names these names will
be reordered. I am looking to make a plot, graph, with the two origins of
the names in separate columns and a line connecting them to visually
represent how much they have moved in the reordering.
Surely there is some great example code for this on the net an am not
finding a clean example.

Thanks
Vincent Davis
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32203] [ctypes] test_struct_by_value fails on android-24-arm64

2018-01-23 Thread pmpp

Change by pmpp :


--
nosy: +pmpp

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue32436] Implement PEP 567

2018-01-23 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +5132

___
Python tracker 

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



[issue32410] Implement loop.sock_sendfile method

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

Andrew, test_cancel2 test fails 1 out of 10 times on my machine (log below).  
Could you please take a look?

Also, can you rename sendfile tests to 'test_sock_sendfile_*'?


{pydev} ~/d/p/cpython (master %) » ./python.exe -m test test_asyncio -v -m 
test_cancel2
== CPython 3.7.0a4+ (heads/master:9d411c119f, Jan 23 2018, 15:12:10) [Clang 
9.0.0 (clang-900.0.39.2)]
== Darwin-17.3.0-x86_64-i386-64bit little-endian
== cwd: /Users/yury/dev/pydev/cpython/build/test_python_65406
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 1.80 [1/1] test_asyncio
test_cancel2 
(test.test_asyncio.test_unix_events.SelectorEventLoopUnixSockSendfileTests) ... 
ERROR

==
ERROR: test_cancel2 
(test.test_asyncio.test_unix_events.SelectorEventLoopUnixSockSendfileTests)
--
Traceback (most recent call last):
  File 
"/Users/yury/dev/pydev/cpython/Lib/test/test_asyncio/test_unix_events.py", line 
487, in cleanup
proto.transport.close()
AttributeError: 'NoneType' object has no attribute 'close'

--
Ran 1 test in 0.010s

FAILED (errors=1)
Task was destroyed but it is pending!
task:  
wait_for=()]>>
test test_asyncio failed
test_asyncio failed

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

___
Python tracker 

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



[issue32296] Implement asyncio._get_running_loop() and get_event_loop() in C

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 9d411c119fdd8e42209ec16be27686a843507f18 by Yury Selivanov in 
branch 'master':
bpo-32296: Make get_running_loop() another 4-5x faster (#5277)
https://github.com/python/cpython/commit/9d411c119fdd8e42209ec16be27686a843507f18


--

___
Python tracker 

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



[issue32638] distutils test errors with AIX and xlc

2018-01-23 Thread Michael Felt

New submission from Michael Felt :

While working in issue11191 I found a fix for Python3-3.6 and later for the 
following tests, and later - but not for Python3-3.5

I suppose "we" could ignore the error on Python3-3.5 (as I then have a quick - 
simple - fix for Python3-3.6 and later.

Suggestions, rather - how important are the tests on Python3-3.5?



root@x066:[/data/prj/python/git/x066-python3-3.7]nohup ./python 
Lib/test/test_distutils.py | egrep "^(ERROR|FAIL):"
ERROR: test_run (distutils.tests.test_build_clib.BuildCLibTestCase)
ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_build_ext (distutils.tests.test_build_ext.ParallelBuildExtTestCase)
ERROR: test_get_outputs 
(distutils.tests.test_build_ext.ParallelBuildExtTestCase)
ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase)

root@x066:[/data/prj/python/python3-3.6.4]nohup ./python 
../src/python3-3.6.4/Lib/test/test_distutils.py | egrep "^(ERROR|FAIL):"
ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_build_ext (distutils.tests.test_build_ext.ParallelBuildExtTestCase)
ERROR: test_get_outputs 
(distutils.tests.test_build_ext.ParallelBuildExtTestCase)
ERROR: test_run (distutils.tests.test_build_clib.BuildCLibTestCase)
ERROR: test_search_cpp (distutils.tests.test_config_cmd.ConfigTestCase)
ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase)

root@x066:[/data/prj/python/python3-3.5.4]nohup ./python 
Lib/test/test_distutils.py | egrep "^(ERROR|FAIL):"
ERROR: test_record_extensions (distutils.tests.test_install.InstallTestCase)
ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase)
ERROR: test_build_ext (distutils.tests.test_build_ext.ParallelBuildExtTestCase)
ERROR: test_get_outputs 
(distutils.tests.test_build_ext.ParallelBuildExtTestCase)
FAIL: test_sysconfig_compiler_vars 
(distutils.tests.test_sysconfig.SysconfigTestCase)
FAIL: test_sysconfig_module (distutils.tests.test_sysconfig.SysconfigTestCase)

--
components: Distutils
messages: 310519
nosy: Michael.Felt, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils test errors with AIX and xlc
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Processing a key pressed in Python 3.6 黎

2018-01-23 Thread Virgil Stokes

Thanks very much Chris,

This code worked perfectly for "Enter". Your knowledge of  Python and 
more specifically this elegant solution are greatly appreciated. I now 
know that I need to learn more about threads. :-)


On 2018-01-23 20:15, Chris Angelico wrote:

On Wed, Jan 24, 2018 at 5:50 AM, Virgil Stokes  wrote:

I would appreciate help on finding a solution to following problem. This is
the general structure of the "problem" code:


while True
 # Get some data from the web and process it
 ...
 ...
 # Write these data to a file
 ...
 ...
 # Check if a_key has been pressed in the command window
 ...
 ...
 if a_key_pressed:
 # Perform some pre-termination tasks
 ...
 ...
 # Close the output data file
 ...
 ...
 raise SystemExit('Exit')


I am running the code with Python 3.6 on a windows 10 platform. I have tried
many approaches (mainly those posted on stackoverflow) but I have yet to
find an approach that works for this structure.

Note:
   1) The code is executed in the windows 10 command window
   2) I am not using wxPython, IDLE, or pyGame in this application.
   3) The time to get the data, process it and write it to a file can
  take from 0.5 sec to 1.5 sec
   4) The key hit need not be echoed to the command window


Are you okay with demanding a specific key, rather than simply "press
any key"? Even better, key combination? Handle Ctrl-C by catching
KeyboardInterrupt and you can take advantage of Python's existing
cross-platform handling of the standard interrupt signal.

If Ctrl-C won't work for you, how about stipulating that it be Enter?
"Press Enter to quit" isn't too much worse than "Press any key to
quit" (plus you have less chance of accidentally terminating the
program when you don't want to). Spin off a thread to wait for enter.
I've tested this only on Linux, but it ought to work:

import threading
import time

shutdown = False
def wait_for_enter():
 print("Hit Enter to quit.")
 input()
 global shutdown; shutdown = True

threading.Thread(target=wait_for_enter).start()

while "more work to do":
 print("Getting data...")
 time.sleep(1)
 print("Saving data to file...")
 time.sleep(1)
 if shutdown:
 print("Pre-termination...")
 time.sleep(1)
 raise SystemExit("exit")

If it doesn't, try switching around which is the secondary thread and
which is the primary - spin off a thread to do the work, then call
input() in the main thread.

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


[issue32637] Android: set sys.platform to android

2018-01-23 Thread pmpp

Change by pmpp :


--
nosy: +pmpp

___
Python tracker 

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



Re: Processing a key pressed in Python 3.6

2018-01-23 Thread Chris Angelico
On Wed, Jan 24, 2018 at 5:50 AM, Virgil Stokes  wrote:
> I would appreciate help on finding a solution to following problem. This is
> the general structure of the "problem" code:
>
>> while True
>> # Get some data from the web and process it
>> ...
>> ...
>> # Write these data to a file
>> ...
>> ...
>> # Check if a_key has been pressed in the command window
>> ...
>> ...
>> if a_key_pressed:
>> # Perform some pre-termination tasks
>> ...
>> ...
>> # Close the output data file
>> ...
>> ...
>> raise SystemExit('Exit')
>
>
> I am running the code with Python 3.6 on a windows 10 platform. I have tried
> many approaches (mainly those posted on stackoverflow) but I have yet to
> find an approach that works for this structure.
>
> Note:
>   1) The code is executed in the windows 10 command window
>   2) I am not using wxPython, IDLE, or pyGame in this application.
>   3) The time to get the data, process it and write it to a file can
>  take from 0.5 sec to 1.5 sec
>   4) The key hit need not be echoed to the command window
>

Are you okay with demanding a specific key, rather than simply "press
any key"? Even better, key combination? Handle Ctrl-C by catching
KeyboardInterrupt and you can take advantage of Python's existing
cross-platform handling of the standard interrupt signal.

If Ctrl-C won't work for you, how about stipulating that it be Enter?
"Press Enter to quit" isn't too much worse than "Press any key to
quit" (plus you have less chance of accidentally terminating the
program when you don't want to). Spin off a thread to wait for enter.
I've tested this only on Linux, but it ought to work:

import threading
import time

shutdown = False
def wait_for_enter():
print("Hit Enter to quit.")
input()
global shutdown; shutdown = True

threading.Thread(target=wait_for_enter).start()

while "more work to do":
print("Getting data...")
time.sleep(1)
print("Saving data to file...")
time.sleep(1)
if shutdown:
print("Pre-termination...")
time.sleep(1)
raise SystemExit("exit")

If it doesn't, try switching around which is the secondary thread and
which is the primary - spin off a thread to do the work, then call
input() in the main thread.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Processing a key pressed in Python 3.6

2018-01-23 Thread Virgil Stokes
I would appreciate help on finding a solution to following problem. This 
is the general structure of the "problem" code:



while True
    # Get some data from the web and process it
    ...
    ...
    # Write these data to a file
    ...
    ...
    # Check if a_key has been pressed in the command window
    ...
    ...
    if a_key_pressed:
    # Perform some pre-termination tasks
    ...
    ...
        # Close the output data file
        ...
        ...
        raise SystemExit('Exit')


I am running the code with Python 3.6 on a windows 10 platform. I have 
tried many approaches (mainly those posted on stackoverflow) but I have 
yet to find an approach that works for this structure.


Note:
  1) The code is executed in the windows 10 command window
  2) I am not using wxPython, IDLE, or pyGame in this application.
  3) The time to get the data, process it and write it to a file can
 take from 0.5 sec to 1.5 sec
  4) The key hit need not be echoed to the command window


--
https://mail.python.org/mailman/listinfo/python-list


[issue11191] test_search_cpp error on AIX (with xlc)

2018-01-23 Thread Michael Felt

Michael Felt  added the comment:

Just tested the patch presented.

For Python3-3.6.4 the patch in PR-5206 works as is, however, for Python3-3.5.4 
- the patch to Lib/test/support/__init__.py does not work.

So, for Python3-3.5, Python3-3.6 and Python3-master - the test test_search_cpp 
is resolved.

As that is the "literal" question here - I am removing the patch to 
Lib/test/support/__init__.py so that the same tests fail (for different 
reasons). I'll open a new issue for these tests - so that this PR can be 
applied to all current Python3 branches (and skip the test_search_cpp test when 
the compiler is not gcc on AIX).

HTH!

--
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Huh, weird. I'll take a look.

--

___
Python tracker 

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



Re: python to C code generator

2018-01-23 Thread bartc

On 23/01/2018 13:34, bartc wrote:
Perhaps you simply want to use Python syntax to write C code? That would  > be a different kind of translator. And a simpler one, as 'a=b+c' > 

translates to 'a+b+c;' in C.
Or rather, 'a=b+c;'

(I've written source to source translators, some of which could target 
C, but not Python to C.


It would be feasible to write C code in a syntax that looks rather like 
Python, but it won't be real Python, and you can't run it as Python.


It wouldn't be a satisfactory way of writing C programs. So, although 
I'm not that big a fan of C syntax, it might be better to write C as C, 
and Python as Python, to avoid confusion.)


--
bartc

--
https://mail.python.org/mailman/listinfo/python-list


[issue32637] Android: set sys.platform to android

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

Wait, os.name is 'posix' on Android. That's fine in fact. Only sys.platform 
should be updated.

--
title: Android: set sys.platform and os.name to android -> Android: set 
sys.platform to android

___
Python tracker 

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



[issue32634] Message parsing fails where it has incompele headers

2018-01-23 Thread R. David Murray

R. David Murray  added the comment:

Yes, it is.

--
stage: patch review -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue32633] Warnings from test_asyncio.test_tasks.SetMethodsTest

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:

> I don't think that 6934831e43d66222a626403dd775429d1c8963f3 can address the 
> leak in any way.

If a coroutine lives longer than expected, its refcount may be decreased after 
regrtest checks the total reference counter.

Anyway, it's not a big deal. If the bug comes back, trust me, I will bug you 
again :-)

--

___
Python tracker 

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



[issue27321] Email parser creates a message object that can't be flattened

2018-01-23 Thread R. David Murray

R. David Murray  added the comment:

Note: I reviewed this a while ago but the review comments haven't been 
addressed.

--

___
Python tracker 

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



[issue32612] pathlib.(Pure)WindowsPaths can compare equal but refer to different files

2018-01-23 Thread R. David Murray

R. David Murray  added the comment:

Could WindowsPath (as opposed to PureWindowsPath) call samefile as part of the 
equality test?  (I'm not familiar enough with pathlib to know if that is a 
nonsense question.)

--

___
Python tracker 

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



[issue32612] pathlib.(Pure)WindowsPaths can compare equal but refer to different files

2018-01-23 Thread R. David Murray

R. David Murray  added the comment:

Maybe we could at least mention the issue (and perhaps link to samefile) in the 
"General Properties" section?

--
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



[issue32637] Android: set sys.platform and os.name to android

2018-01-23 Thread STINNER Victor

New submission from STINNER Victor :

Currently, sys.platform and os.name are equal to 'linux' on Android. While 
Android uses the Linux kernel, the operating system is not a regular Linux. The 
libc (bionic) is very different than the regular glibc, the filesystem is 
organized very differently, etc.

I propose to change sys.platform and os.name to 'android' when running on 
Android.

--
components: Library (Lib)
messages: 310511
nosy: vstinner, xdegaye
priority: normal
severity: normal
status: open
title: Android: set sys.platform and os.name to android
versions: Python 3.7

___
Python tracker 

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



[issue32633] Warnings from test_asyncio.test_tasks.SetMethodsTest

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

However I ran the whole asyncio test suite in reftracking mode on my machine 
(latest master) and it passed.  So I guess this issue is indeed closed.

--

___
Python tracker 

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



[issue30491] Add a lightweight mechanism for detecting un-awaited coroutine objects

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

I'd like to see benchmarks of coroutine creation time and awaits with and 
without the proposed patch.

--

___
Python tracker 

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



[issue32633] Warnings from test_asyncio.test_tasks.SetMethodsTest

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

I don't think that 6934831e43d66222a626403dd775429d1c8963f3 can address the 
leak in any way.

--

___
Python tracker 

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



[issue31930] IDLE: Pressing "Home" on Windows places cursor before ">>>"

2018-01-23 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

#17060 and #18444 are similar issues for Mac.

--

___
Python tracker 

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



[issue32636] test_asyncio fails with PYTHONASYNCIODEBUG=1

2018-01-23 Thread Yury Selivanov

Yury Selivanov  added the comment:

Nathaniel, this is is a regression of fc2f407829d9817ddacccae6944dd0879cfaca24 
-- bpo-32591: Add native coroutine origin tracking.

Please take a look.

--
nosy: +njs

___
Python tracker 

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



[issue32618] fix test_codeccallbacks.test_mutatingdecodehandler

2018-01-23 Thread Xiang Zhang

Change by Xiang Zhang :


--
resolution:  -> fixed
stage: patch review -> 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



[issue32618] fix test_codeccallbacks.test_mutatingdecodehandler

2018-01-23 Thread Xiang Zhang

Xiang Zhang  added the comment:


New changeset 6abbf14a876ee1e04d1493bb27025f2f0aa56430 by Xiang Zhang (Miss 
Islington (bot)) in branch '3.6':
bpo-32618: Fix test_mutatingdecodehandler not testing test.mutating (GH-5269) 
(#5285)
https://github.com/python/cpython/commit/6abbf14a876ee1e04d1493bb27025f2f0aa56430


--

___
Python tracker 

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



[RELEASED] Python 3.4.8rc1 and Python 3.5.5rc1 are now available

2018-01-23 Thread Larry Hastings


On behalf of the Python development community, I'm pleased to announce 
the availability of Python 3.4.8rc1 and Python 3.5.5rc1.


Both Python 3.4 and 3.5 are in "security fixes only" mode. Both versions 
only accept security fixes, not conventional bug fixes, and both 
releases are source-only.



You can find Python 3.4.8rc1 here:

   https://www.python.org/downloads/release/python-348rc1/


And you can find Python 3.5.5rc1 here:

   https://www.python.org/downloads/release/python-355rc1/



Happy Pythoning,


//arry/
--
https://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: python to C code generator

2018-01-23 Thread Chris Angelico
On Wed, Jan 24, 2018 at 1:45 AM,   wrote:
> Hey Ally,
>
> Cython adds a big chunk of complexity to simple things. That's the problem.

That's like saying "Unicode adds a big chunk of complexity to the
simple task of translating a word from Japanese into Russian". No, it
doesn't; the complexity is inherent in the problem. You cannot
translate Python code into C code without either (a) reimplementing
all of Python's semantics, as Cython does; or (b) drastically changing
the semantics, such that even the very simplest of code might behave
quite differently; or (c) manually reading through the code and
writing equivalent C, which is what you might call "porting" or
"rewriting". (Or possibly "prototyping", if the intention was always
to transform it into C.) There is fundamentally NO easy way to
translate code from one language into another and get readable,
idiomatic code at the other end.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32635] test_crypt segfaults when using libxcrypt instead of libcrypt

2018-01-23 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset e768c86ef442ef89004089a8a34ce5909ffb90f2 by Victor Stinner 
(stratakis) in branch 'master':
 bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. 
(#5284)
https://github.com/python/cpython/commit/e768c86ef442ef89004089a8a34ce5909ffb90f2


--

___
Python tracker 

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



Re: python to C code generator

2018-01-23 Thread theodore . leblanc

Hey Ally,

Cython adds a big chunk of complexity to simple things. That's the problem.

Greetings.

On 01/23/2018 01:54 PM, ally.m...@bankmail.host wrote:

Have you tried cython ?

On 01/23/2018 01:25 PM, kushal bhattacharya wrote:
On Wednesday, January 17, 2018 at 4:34:23 PM UTC+5:30, kushal 
bhattacharya wrote:

Hi,
Is there any python framework or any tool as  which can generate C 
code from python code as it is .


Thanks,
Kushal


hi,
I have found nuitka as asuitable candidate but it seems that nuitka 
doesnt generate a simple C code which could be included as a C file in 
another program.Is there any alternative easier way regarding this?


Thanks


--
https://mail.python.org/mailman/listinfo/python-list


  1   2   >