Re: Temporary variables in list comprehensions

2017-04-07 Thread Jussi Piitulainen
Roel Schroeven writes:

> Lele Gaifax schreef op 6/04/2017 20:07:
>> Piet van Oostrum  writes:
>>
>>> It is a poor man's 'let'. It would be nice if python had a real 'let'
>>> construction. Or for example:
>>>
>>> [(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)]
>>>
>>> Alas!
>>
>> It would be nice indeed!
>>
>> Or even
>>
>>   [(tmp, tmp + 1) for x in data
>>with expensive_calculation(x) as tmp
>>if tmp is not None]
>>
>
> Perhaps this:
>
> [(tmp, tmp + 1) for tmp in
>  (expensive_calculation(x) for x in data)
>  if tmp is not None]
>
> A bit less elegant, but works right now.

The "poor man's let" works right now.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-04-07 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
pull_requests: +1193

___
Python tracker 

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



[issue30019] IDLE freezes when opening a file with astral characters

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

In Windows IDLE 3.x, you should still be able to print a surrogate transcoding, 
which sneaks the native UTF-16LE encoding around tkinter:

def transurrogate(s):
b = s.encode('utf-16le')
return ''.join(b[i:i+2].decode('utf-16le', 'surrogatepass') 
   for i in range(0, len(b), 2))

def print_surrogate(*args, **kwds):
new_args = []
for arg in args:
if isinstance(arg, str):
new_args.append(transurrogate(s))
else:
new_args.append(arg)
return print(*new_args, **kwds)


>>> s = '\U0001f52b \U0001f52a'
>>> print_surrogate(s)
 

Pasting non-BMP text into IDLE fails on Windows for a similar reason. Tk 
naively encodes the surrogate codes in the native Windows UTF-16 text as 
invalid UTF-8, which I've seen refereed to as WTF-8 (Wobbly). I see the 
following error when I run IDLE using python.exe (i.e. with a console) and 
paste " " into the window:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 1: 
invalid continuation byte

This is the second byte of the WTF-8 encoding:

>>> transurrogate('"\U0001f52b').encode('utf-8', 'surrogatepass')
b'"\xed\xa0\xbd\xed\xb4\xab'

Hackiness aside, I don't think it's worth supporting this just for Windows.

--
nosy: +eryksun

___
Python tracker 

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



[issue24117] Wrong range checking in GB18030 decoder.

2017-04-07 Thread Ma Lin

Ma Lin added the comment:

I closed this issue, because it involved too many things.
 
1, for GB18030 decoder bug, see issue29990.
2, for hz encoder bug, see issue30003.
3, for problem in Traditional Chinese codecs, please create a new issue.

--

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread Ma Lin

Ma Lin added the comment:

>From my subjective feelings, probably no old archives still exist, but I can't 
>assert it. That's why I suggest remove it, or at least don't fix it.

Ah, let's slow down the pace, this bug exists over a dacade, we don't need to 
solve it at once.

I closed #24117, because it became a soup of small issues, so I split it into 
individual issues (such as this issue).

--

___
Python tracker 

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



[issue30020] Make attrgetter use namedtuple

2017-04-07 Thread Isaac Morland

New submission from Isaac Morland:

I would find it useful if the tuples returned by attrgetter functions were 
namedtuples.  An initial look at the code for attrgetter suggests that this 
would be an easy change and should make little difference to performance.  
Giving a namedtuple where previously a tuple was returned seems unlikely to 
trigger bugs in existing code so I propose to simply change attrgetter rather 
than providing a parameter to specify whether or not to use the new behaviour.

Patch will be forthcoming but comments appreciated.

--
components: Library (Lib)
messages: 291314
nosy: Isaac Morland
priority: normal
severity: normal
status: open
title: Make attrgetter use namedtuple
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



[issue30019] IDLE freezes when opening a file with astral characters

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Your report touches on four different issues.

1. IDLE uses tkinter for the GUI and tkinter wraps tcl/tk 8.6 or earlier, which 
only handles Basic Multilingual Plane chars (codepoints  to ). The gun 
and knife chars are out of that range.  I have read that 8.7 will handle all 
unicode chars and that it might be released this year.  This will fix multiple 
IDLE issues (#21084, #22742, #13153, #14304).

2. Until 3.3, CPython used two internal unicode encoding schemes: Narrow and 
wide builds.  Narrow builds used pairs of surrogate chars in the BMP to 
represent chars not in the BMP.  So your '3 char' string is stored as 5 chars.

# -*- coding: utf-8 -*-
text = u" "
for c in text:
print(ord(c))

*prints, on 2.7.13 on Windows
55357
56619
32
55357
56618

Windows releases and a few *nix releases used narrow builds.  I have Windows, 
so I could copy and paste your string and run the above.  Most *nix releases 
used wide builds and could not.

In 3.3, CPython switched to a flexible representation used on all releases.  
Like earlier wide builds, it does not use surrogate chars, and the above no 
longer loads into a text widget, let alone run.

3. Any exception not caught by IDLE generates a traceback that appears on the 
console used to start IDLE, if there is one.  Otherwise, it is lost.  Running 
" -m idlelib" in a console and loading the code above results in a 
traceback ending with "_tkinter.TclError: character U+1f52b is above the range 
(U+000)-(U+) allowed by Tcl".

I have though about (and previously commented about) trying to put such 
messages in a tk message box when IDLE and tk are still functioning well enough 
to do so before stopping.

4. It appears the IDLE opens a file that is not already open by creating a 
blank editor window and then loading the file into it.  In this case, when the 
load fails, a frozen window is left that blocks IDLE closing.  This nasty 
behavior, which I verified, is new to me, so I am leaving this issue open 
specifically for this bug.

A likely fix is to catch TclError in the appropriate place (not yet known to 
me), recover (delete the new EditorWindow and ???), display an explanatory 
error message, and continue when user hits [OK].

We already have a test string.  If needed, I will try to separate 'opening a 
file name' from 'reading the contents', so a test can use a simple mock file 
object.

If a file were opened and read *before* creating a new window, there would be 
less cleanup to do.

--
stage:  -> needs patch
title: IDLE got unexpexted bahavior when trying to use some characters -> IDLE 
freezes when opening a file with astral characters

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

"But for any codec, there might be archives, even if the codec is not
used for new files."

The bug is in the encoder. The codec is still usable to *decode*
files. So maybe a few people use it but didn't notice the encoder bug?

--

___
Python tracker 

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



[issue30000] Inconsistency in the zlib module

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

I don’t have a strong opinion on adding the missing parameters to the one-shot 
“compress” function, though it does seem beneficial to have a consistent set of 
parameters supported across the relevant APIs.

--

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

It looks like the zip entry writer object may not expect its “close” method to 
be called multiple times. Other file objects tend to allow this with no ill 
effect. Adding Serhiy and Thomas who implemented the writer object in Issue 
26039.

The first time it is called will be when the context manager (“with” statement) 
exits.

The second time will be when the TextIOWrapper is garbage-collected. This is 
documented behaviour 
, but I think it 
is a design mistake of the IOBase hierarchy; see Issue 19829.

A reasonable workaround would be to call encoder.detach() after you have 
finished writing the zip entry.

--
nosy: +martin.panter, serhiy.storchaka, takluyver
stage:  -> needs patch

___
Python tracker 

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



Re: Find out which module a class came from

2017-04-07 Thread Rick Johnson
On Friday, April 7, 2017 at 7:49:11 PM UTC-5, Steve D'Aprano wrote:
> But for merely ordinary obfuscation caused by poor design,
> your best bet is probably to inspect Foo.__module__.
> 
> You can also try:
> 
> inspect.getsource(FooClass)
> inspect.getsourcefile(FooClass)

Hmm, I tried that code but all i got was a nameError. 

>>> inspect.getsource(FooClass)

Traceback (most recent call last):
  File "", line 1, in 
inspect.getsource(FooClass)
NameError: name 'inspect' is not defined

>>> inspect.getsourcefile(FooClass)

Traceback (most recent call last):
  File "", line 1, in 
inspect.getsourcefile(FooClass)
NameError: name 'inspect' is not defined

You must be using the Python version that has batteries _and_
imports included.

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


Re: Find out which module a class came from

2017-04-07 Thread Steve D'Aprano
On Sat, 8 Apr 2017 06:24 am, Tobiah wrote:

> I was viewing the python source for a program at work and
> came across a class name that I knew my company had written:
> 
> import mycmp1
> import mycmp2
> import mycmp3
> import mycmp4
> import mycmp5
> 
> foo = FooClass()
> 
> 
> So I knew that FooClass was defined in one of those imports,

No you don't. You know the opposite: FooClass must be defined *locally* in
the current file, because the name isn't fully qualified.

(Well, I say "must" but technically that's not *quite* true... it is
possible that one of the modules mycmp1 etc. could inject FooClass into
your module, but that's pretty unlikely.)

If you have:

from mycmp1 import FooClass
from mycmp2 import FooClass
# etc.

foo = FooClass

then the last import wins. If you have wild-card imports:

from mycmp1 import *
from mycmp2 import *
# etc.

then (1) your dev team should be stoned to death with ripe figs (so it takes
longer), and (2) the same rule applies again: the last module importing a
FooClass will override any previous imports of the same name.


> but 
> I thought it would be tedious to track down the location of all
> of those modules (is module.__file___ the best way) 

I don't know about "best". Actually having a well-structured code base is
probably best. But if you are stuck with a tangled mess, then
module.__file__ is probably your least-worst option.


> and scan them 
> for the class definition.  Is there a better way to find the
> definition of FooClass()?

Keep in mind that a sufficiently perverted and incompetent programmer can
*accidentally* duplicate the trickiest obfuscation used by intentionally
malicious programmers, so there is no guarantee. And if you are trying to
analyse malware, or code written by somebody intentionally obfuscating the
source so as to guarantee job-security, all bets are off.

But for merely ordinary obfuscation caused by poor design, your best bet is
probably to inspect Foo.__module__.

You can also try:

inspect.getsource(FooClass)
inspect.getsourcefile(FooClass)



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Elastic Search

2017-04-07 Thread Steve D'Aprano
On Sat, 8 Apr 2017 06:15 am, Keith Anthony wrote:

> I need some insightful examples of elastic search, using REGEX ...
> And using REST.

What's elastic search?

And what does this have to do with Python?

Can you be more specific rather than assume we know what you want? What have
you tried, what don't you understand, what have you searched for, etc.

We're all volunteers here, we aren't paid to decipher people's mysterious
questions. If deciphering the question is too hard, you won't find many
people willing to spend the time and effort trying to solve it. The better
the question you ask, the better the answers you will probably get.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Ellison Marks

Ellison Marks added the comment:

At a guess, when encoder goes out of scope, it closes the underlying file 
object. Then, on exiting the with block, the zipfile tries to take some action 
with the closed file and errors out?

--
nosy: +Ellison Marks

___
Python tracker 

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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

Raphael: Can you point to the implementation code that handles file objects 
without a file descriptor (or give a demonstration of it)? I suspect there is 
no such support and you are mistaken.

Perhaps we can instead clarify in the “subprocess” documentation that “fileno” 
is required. Issue 19992 already proposes this.

Issue 1260171 and Issue 10482 are also related, about streaming data between 
Python file objects in the parent and pipes connected to the child.

--
nosy: +martin.panter
stage:  -> test needed
superseder:  -> subprocess documentation not explicit about fileno()

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Martin Panter

Martin Panter added the comment:

I agree this is not a bug. It is just one of the unfortunate compatibility 
breaks between Py 2 and 3. Mode="rt" is not one of the values that are 
supported according to the documentation; adding support would be a new feature.

I understand the file mode handling is stricter on Windows because the 
underlying OS or C library would crash.

To have code that works with Py 2 and 3, I would switch the mode depending on 
the version of Python:

if sys.version_info >= (3,):
handle = gzip.open(filename, "rt")
else:
handle = gzip.open(filename)

--
nosy: +martin.panter
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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

This refactoring was already suggested a long time ago, and at the
time both Guido and I didn't like it because it makes the code
actually more complicated: DRY in this case doesn't apply IMO.

Also, this whole thread is a repeat of:
http://bugs.python.org/issue18932

At the time, I already asked for one realistic use case demonstrating
the benefit of implementing modify() natively instead of
unregister()+register().
I know that this code makes modify() faster, but as I said multiple
times, I'd like to se the impact on something else than a
micro-benchmark: arguably if you propose this it's because you've
profiled/found it to be an actual bottleneck, do you have *one*
benchmark to support this change?

--

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Vinay Sajip added the comment:


New changeset ae0915e42d8cd96e5ced1fc442ea078b4a59e82d by Vinay Sajip in branch 
'3.5':
Closes bpo-29939: suppress compiler warnings in _ctypes_test (#1039)
https://github.com/python/cpython/commit/ae0915e42d8cd96e5ced1fc442ea078b4a59e82d


--
status: open -> closed

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Vinay Sajip added the comment:


New changeset d0d575a6db8cb3b2a720be9f404af3d754da9a5d by Vinay Sajip in branch 
'3.6':
bpo-29939: suppress compiler warnings in _ctypes_test (#1038)
https://github.com/python/cpython/commit/d0d575a6db8cb3b2a720be9f404af3d754da9a5d


--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Peter

Peter added the comment:

A workaround for my use case is even simpler, something like this:

try:
handle = gzip.open(filename, "rt")
except ValueError:
# Workaround for Python 2.7 under Windows
handle = gzip.open(filename, "r")

However, even this is troublesome for use in documentation intended to work on 
Python 2 and 3, over Linux, Mac and Windows.

--

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

Charles McEachern added the comment:

That seems to do it! Looks like the trick is to define __reduce__ to help out 
the serializer. Thanks!

--

___
Python tracker 

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



[issue23894] lib2to3 doesn't recognize rb'...' and f'...' in Python 3.6

2017-04-07 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue1207613] Idle Editor: Bottom Scroll Bar

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I don't like telling people to hand-edit .idlerc files. It causes too many 
problems.  We added Extensions tab to avoid this.  I think all supported 
options should be on dialog.

Windows are resizable and accommodate lines up to current width.  Default width 
is user settable option.  So people who want to edit 100 char lines for code 
can and have editor open with 100 char width.

Shell,Edit, and Output windows should not necessarily be same.  Currently, 
Shell wraps both input and output while Editor Output truncate code input and 
grep output respectively.  I plan to review this, including possible scrollbar, 
but not a priority.

--
assignee:  -> terry.reedy

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Changes by Vinay Sajip :


--
pull_requests: +1192

___
Python tracker 

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



[issue29939] Compiler warning in _ctypes_test.c

2017-04-07 Thread Vinay Sajip

Changes by Vinay Sajip :


--
pull_requests: +1191

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

You want to hack a fake text mode, which won't do new-line translation or treat 
^Z (0x1a) as EOF like a normal 2.x text mode on Windows. Can't you just use 
io.TextIOWrapper(gzip.open(filename))? This reads Unicode.

--

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread R. David Murray

R. David Murray added the comment:

I suspect you just need to add pickle support to your class.  When I subclassed 
str in the email package, I found I needed to do that.  I'd have to go through 
the docs again to remember how the code works, but you can take a look at the 
BaseHeader class in email.headerregistry to see what I did.

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



[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +alex, christian.heimes, dstufft, janssen

___
Python tracker 

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



[issue30003] Remove hz codec

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We seldom just remove things; we usually deprecate in the doc and if possible, 
issue a runtime warning.

This is probably not the only obsolete codec.  There should be a uniform policy 
for deprecation and removal, if ever.  But for any codec, there might be 
archives, even if the codec is not used for new files.

If the codec is buggy, I think it should be fixed. Bt you yourself closed 
#24117, suggesting that you did not believe that the patches should be applied.

--
nosy: +terry.reedy

___
Python tracker 

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



Re: Temporary variables in list comprehensions

2017-04-07 Thread Roel Schroeven

Lele Gaifax schreef op 6/04/2017 20:07:

Piet van Oostrum  writes:


It is a poor man's 'let'. It would be nice if python had a real 'let'
construction. Or for example:

[(tmp, tmp + 1) for x in data with tmp = expensive_calculation(x)]

Alas!


It would be nice indeed!

Or even

  [(tmp, tmp + 1) for x in data
   with expensive_calculation(x) as tmp
   if tmp is not None]



Perhaps this:

[(tmp, tmp + 1) for tmp in
 (expensive_calculation(x) for x in data)
 if tmp is not None]

A bit less elegant, but works right now.


--
Roel Schroeven

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


[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

> I am unfortunately not at liberty to share the code I'm working on.

I very much understand and am very thankful you took the time to create a 
simple example that you could share.  Honestly, that's the reason I felt 
inspired to stop what I was doing to look at this now rather than later.


> I suppose I should just work around it by checking right away if the input to 
> my constructor has already been constructed!

There are probably a number of different ways to address it but your suggestion 
of adding a check to see if this is the first time that object has been 
constructed sounds like it might be an easy win.

--

___
Python tracker 

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



[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

'crash' means OS message rather than Python exiting with exception traceback 
and message.

Can you post a minimal reproducer?  What OS?  subprocess.Popen._get_handles is 
different on POSIX and windows, though both seem to call f.fileno() without 
try-except. 

All filenoes are initialized to -1, so it seems to me that either
a. all accesses should be wrapped with try-except: pass, or
b. subprocess doc should say that file-like objects must include a fileno 
method returning -1.

I am puzzled though.  The 2.7 doc for (builtin)file.fileno() says 
"
Note
File-like objects which do not have a real file descriptor should not provide 
this method! "
"
Rather than return -1

In must be that the subprocess test does not test with a 'file-like object 
without a file descriptor'

--
nosy: +terry.reedy
type: crash -> behavior

___
Python tracker 

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



Re: Elastic Search

2017-04-07 Thread breamoreboy
On Friday, April 7, 2017 at 9:16:51 PM UTC+1, Keith Anthony wrote:
> I need some insightful examples of elastic search, using REGEX ...
> And using REST.

What was wrong with the hits that you got from your search engine of choice?

Kindest regards.

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


[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

Charles McEachern added the comment:

This caused me several hours of misery yesterday, trying to isolate what was 
going wrong. 

I am unfortunately not at liberty to share the code I'm working on. The example 
on GitHub has the general thrust of it: my constructor was always called in a 
specific way, and didn't expect to be given something that was already 
processed. 

Interesting to see that this is a product of pickling. That makes me think that 
"fixing" this corner case would probably be a lot of work.

I suppose I should just work around it by checking right away if the input to 
my constructor has already been constructed!

--

___
Python tracker 

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



[issue28643] Broken makefile depends for profile-opt target

2017-04-07 Thread Douglas Greiman

Changes by Douglas Greiman :


--
nosy: +dgreiman

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

Expanding my above example to show how multiprocessing relates:
>>> import multiprocessing
>>> import os
>>> class Floof(object):
... def __new__(cls):
... print("New via pid=%d" % os.getpid())
... return object.__new__(cls)
... 
>>> os.getpid()   # parent pid
46560
>>> pool = multiprocessing.Pool(1)
>>> getter = pool.apply_async(Floof, (), {})  # output seen from child AND 
>>> parent
>>> New via pid=46583
New via pid=46560

>>> getter.get()  # everything seems to be working 
>>> as intended
<__main__.Floof object at 0x10866f250>


FWIW, near the end of my prior message:  s/it didn't merely/it merely/

--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Peter

Peter added the comment:

I want a simple cross platform (Linux/Mac/Windows) and cross version (Python 
2/3) way to be able to open a gzipped file and get a string handle (default 
encoding TextIOWrapper under Python 3 is fine). My use-case is specifically for 
documentation examples.

Previously I used gzip.open(filename) but with the introduction of Python 3 
that stopped working because the Python 3 default was to give you bytes.

Thanks to http://bugs.python.org/issue13989 switching to  gzip.open(filename, 
"rt") almost covered my use case, leaving Python 2 windows as the odd one out.

I propose that under Python 2.7, gzip.open explicit accept but ignore "t" as 
part of the mode argument in order to allow cross-platform code to work nicely.

i.e. Formalise the observed Python 2.7 behaviour under Linux and Mac which 
ignore the "t", and change Windows so that it ignores the "t" as well.

--

___
Python tracker 

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Davin Potts

Davin Potts added the comment:

It looks like the first 'Called Foo.__new__' is being reported by the child 
(pool of 1) process and the second 'Called Foo.__new__' is being reported by 
the parent process.  In multiprocessing, because objects are by default 
serialized using pickle, this may be caused by the unpickling of the Foo object 
by the parent process which is something you would not experience when using 
ThreadPool because it does not have the same need for serialization.

Example showing invocation of __new__ as part of unpickling:
>>> class Foo(object):
... def __new__(cls):
... print("New")
... return object.__new__(cls)
... 
>>> import pickle
>>> f = Foo()
New
>>> pf = pickle.dumps(f, protocol=2)
>>> pickle.loads(pf)  # unpickling triggers __new__
New
<__main__.Foo object at 0x1084a06d0>



Having discovered this phenomenon, is this causing a problem for you somewhere 
in code?  (Your example code on github was helpful, thank you, but it didn't 
merely demonstrated the behavior and didn't show where this was causing you 
pain.)

--
nosy: +davin

___
Python tracker 

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



Re: Find out which module a class came from

2017-04-07 Thread Chris Angelico
On Sat, Apr 8, 2017 at 6:24 AM, Tobiah  wrote:
> I was viewing the python source for a program at work and
> came across a class name that I knew my company had written:
>
> import mycmp1
> import mycmp2
> import mycmp3
> import mycmp4
> import mycmp5
>
> foo = FooClass()
>
>
> So I knew that FooClass was defined in one of those imports, but
> I thought it would be tedious to track down the location of all
> of those modules (is module.__file___ the best way) and scan them
> for the class definition.  Is there a better way to find the
> definition of FooClass()?

If they're just "import modulename", then FooClass won't be defined
unless it's been injected into the builtins or something. Are they
"from mycmp1 import *"?

Normally, you should be able to just look at FooClass.__module__ to
see where it's been created. But if your module layout is messy, that
might not be sufficient information.

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


Find out which module a class came from

2017-04-07 Thread Tobiah
I was viewing the python source for a program at work and
came across a class name that I knew my company had written:

import mycmp1
import mycmp2
import mycmp3
import mycmp4
import mycmp5

foo = FooClass()


So I knew that FooClass was defined in one of those imports, but
I thought it would be tedious to track down the location of all
of those modules (is module.__file___ the best way) and scan them
for the class definition.  Is there a better way to find the 
definition of FooClass()?


Thanks!



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


[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If you want to know if a function returns a generator, you have to call it and 
pass the result to *isgenerator*, or use type-annotated functions (see the 
typing module) and static type checkers.

--

___
Python tracker 

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



[issue29987] inspect.isgeneratorfunction not working with partial functions

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A generator function *gf* is a function that contain *yield* in its body.  When 
it is compiled, flag CO_GENERATOR is set in gf.__code__.co_flags.  When the 
function is called, the flag is queried and if set, a special path is taken 
that attaches the live but suspended code instance to a generator instance.

*isgeneratorfunction* tests that an object is a function and that the flag is 
set.

return bool((isfunction(object) or ismethod(object)) and
object.__code__.co_flags & CO_GENERATOR)

This is exactly what it should do.

Any function could potentially call a generator function and return its result. 
 Martin's *test2*, with or without the wrapper, is an example.

Note that *iscoroutinefunction* and *isaynchgenfunction* follow the same 
pattern, but with different flags.  A 4th flag is queried by *isawaitable*. The 
return object of any of these could also by returned by other functions.

--
nosy: +terry.reedy
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type:  -> enhancement
versions: +Python 3.7 -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



Elastic Search

2017-04-07 Thread Keith Anthony
I need some insightful examples of elastic search, using REGEX ...
And using REST.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30019] IDLE got unexpexted bahavior when trying to use some characters

2017-04-07 Thread David E. Franco G.

New submission from David E. Franco G.:

wandering for the internet I fount some unicode character in a random comment, 
and just for curiosity I wanted to use python (3.6.1) to see their value, so I 
copy those characters and paste them in IDLE, and in doing so it just close 
without warning or explanation.

the character in question are:  
(chr(128299) and chr(128298))

then I put them in a script 

text = " "
print(text)

and try to load it but instead it open a new empty scrip, again without 
apparent reason, which for some reason I can't close, I needed to kill the 
process for that.

I try the same with the IDLE in python 2.7.13 for the first one I got

Unsupported characters in input

which at least is something, and changing the script a little

# -*- coding: utf-8 -*-
text = u" "
print(text)

it work without problem and print correctly. 

Also opening the script in interactive mode (python -i myscript.py) it work as 
expected and I get their numbers (that I put above).

So why is that? and please fix it.

--
assignee: terry.reedy
components: IDLE
messages: 291289
nosy: David E. Franco G., terry.reedy
priority: normal
severity: normal
status: open
title: IDLE got unexpexted bahavior when trying to use some characters
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



[issue29980] OSError: multiple exceptions should preserve the exception type if it is common

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree.  And if the sub-exceptions are different, prepend them to the messages 
in the OSError list.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue29976] urllib.parse clarify what ' ' in schemes mean

2017-04-07 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
pull_requests: +1190

___
Python tracker 

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



[issue29975] Issue in extending documentation

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree with the rejection on the PR.

--
nosy: +terry.reedy
resolution:  -> not a bug
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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

@neologix: here's a PR which refactors the poll-related classes: 
https://github.com/python/cpython/pull/1035/files
>From there, we'll be able to avoid modify() code duplication.

--

___
Python tracker 

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



[issue29956] math.exp documentation is misleading

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Is math.exp(x) always more accurate than math.e ** x?  If so, doc could say so. 
 Otherwise, should this be closed?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue23984] Documentation error: Descriptors

2017-04-07 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1189

___
Python tracker 

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



[issue29071] IDLE doesn't highlight f-strings properly

2017-04-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

#29287 is about syntax highlighting the code within f-strings as code rather 
than as part of the string.

--

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

In Python 3, gzip.open(filename, "rt") returns a TextIOWrapper using the 
system's default encoding. The decoded output is potentially very different 
from the byte string returned by 'text mode' in Python 2, even if using "rt" 
mode didn't result in the nonsensical "rtb" mode. I suggest using the default 
binary mode, and manually wrapping the file in an io.TextIOWrapper.

--
nosy: +eryksun

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

In certain protocols modify() is supposed to be used on every interaction 
between client and server. E.g. an FTP server does this:

- register(fd, EVENT_READ); recv() # wait command from client
- modify(fd, EVENT_WRITE); send(response)  # send response
- modify(fd, EVENT_READ); recv()   # wait for new command

...so it's two calls for each command received.
In asyncio modify() is also used in different circumstances. 
If you're worried about code duplication I can refactor selectors.py first, but 
IMO it would be a bad idea to reject this or future improvements because the 
current code status prevents code reuse. Right now there are already 3 classes 
sharing basically the same code (poll, epoll and devpoll related classes). 
Those can be refactored similarly to this:
https://github.com/giampaolo/pyftpdlib/blob/ab699b5f89223e03593f3e004d6a370b4c2e5308/pyftpdlib/ioloop.py#L465-L565

--

___
Python tracker 

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



[issue29974] Change typing.TYPE_CHECKING doc example

2017-04-07 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread LCY

LCY added the comment:

Thank you for testing and explanation.

My test cases are not enough.

I will close this issue.

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

> I don't think that selector.modify() can be a bottleneck, but IMHO the change 
> is simple and safe enough to be worth it. In a network server with 10k 
> client, an optimization making .modify() 1.52x faster is welcomed.

IMHO it complicates the code for little benefit: that's why I asked
for a realistic benchmark. This patch could made modify() 10x faster,
if modify() only accounts for 1% of the overall overhead in a
realistic use-case, then it's not worth it.

--
title: Speedup DefaultSelectors.modify() by 1.5x -> Speedup 
DefaultSelectors.modify() by 2x

___
Python tracker 

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



[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-07 Thread R. David Murray

R. David Murray added the comment:

I don't think this is really a bug, I think it's a consequence of the different 
byte/string models of python2 and python3 coupled with the different 
binary/text models of posix and windows.

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



[issue30018] multiprocessing.Pool garbles call stack for __new__

2017-04-07 Thread Charles McEachern

New submission from Charles McEachern:

I'm calling the constructor of Foo, a subclass of str. Expected output:

Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
TIMESTAMP OUTPUT0

When I make the call using a multiprocessing.pool.ThreadPool, it works fine. 
But when I make the call using a multiprocessing.Pool (using the apply or 
apply_async method), I get:

Called Foo.__new__ with args = ('TIMESTAMP', 'INPUT0')
Called Foo.__new__ with args = ('TIMESTAMP OUTPUT0',)
Exception in thread Thread-3:
...
ValueError: Bad Foo input: ('TIMESTAMP OUTPUT0',)

That is, the object I just constructed seems to be getting shoved right back 
into the constructor. 

When I swap out the Foo class for the similar Goo class, which is not a str, 
and uses __init__ instead of __new__, I again see no problems:

Called Goo.__init__ with args = ('TIMESTAMP', 'INPUT0')


I see this in 2.7.9 as well as 3.4.5. Looks like it's present in 2.7.2 and 
3.5.2 as well:

https://github.com/charles-uno/python-new-pool-bug/issues/1

--
components: Library (Lib)
files: newpool.py
messages: 291278
nosy: Charles McEachern
priority: normal
severity: normal
status: open
title: multiprocessing.Pool garbles call stack for __new__
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file46790/newpool.py

___
Python tracker 

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



[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread Eryk Sun

Eryk Sun added the comment:

> Windows also treats full-width spaces as a delimiter when parsing 
> command line arguments.

CreateProcess has to parse the beginning of the command-line string if the 
lpApplicationName parameter is omitted. According to the documentation, it 
treats "white space" as a delimiter, but it doesn't actually say which 
characters are in that set. We know for an unquoted name like 
"python{character}spam" that it will try to execute python.exe if "{character}" 
is parsed as a space. Otherwise we expect CreateProcess to fail with 
ERROR_FILE_NOT_FOUND because it's looking for the non-existent file 
"python{character}spam". Here's a test that checks all characters that Unicode 
considers to be whitespace, which includes "ideographic space" (U+3000):

import os
import sys
import subprocess

space_chars = [chr(c) for c in range(sys.maxunicode) if chr(c).isspace()]
assert '\N{IDEOGRAPHIC SPACE}' in space_chars # U+3000

def get_create_delims():
assert not os.path.exists('spam')
filename = 'python{}spam'
basepath = os.path.dirname(sys.executable)
delims = []
for space in space_chars:
path = os.path.join(basepath, filename.format(space))
assert not os.path.exists(path)
try:
subprocess.check_output(path, stderr=subprocess.STDOUT)
except FileNotFoundError:
pass # not a delimiter
except subprocess.CalledProcessError:
delims.append(space)
else:
assert False, 'python.exe should have failed'
return delims


>>> get_create_delims()
['\t', ' ']

CreateProcess considers only space and horizontal tab as white-space 
delimiters, at least on this Windows 10 system.

Otherwise Windows itself doesn't care about the command line. It's up to each 
application to parse its command line however it wants. subprocess.list2cmdline 
assumes an application uses argv from Microsoft's C runtime. The Windows shell 
function CommandLineToArgvW is supposed to follow the same rules. The following 
calls CommandLineToArgvW on a test command-line string for each character in 
the space_chars set:

import ctypes
from ctypes import wintypes

shell32 = ctypes.WinDLL('shell32', use_last_error=True) 

PLPWSTR = ctypes.POINTER(wintypes.LPWSTR)
shell32.CommandLineToArgvW.restype = PLPWSTR

def cmdline2argv(cmdline):
argc = ctypes.c_int()
pargv = shell32.CommandLineToArgvW(cmdline, ctypes.byref(argc))
if not pargv:
raise ctypes.WinError(ctypes.get_last_error())
return pargv[:argc.value]

def get_argv_delims():
cmdline = 'test{}space'
delims = []
for space in space_chars:
if len(cmdline2argv(cmdline.format(space))) > 1:
delims.append(space)
return delims


>>> get_argv_delims()
['\t', '\n', '\x0b', '\x0c', '\r', '\x1c', '\x1d', '\x1e', '\x1f', ' ']

In addition to space and horizontal tab, CommandLineToArgvW also considers line 
feed, vertical tab, form feed, carriage return, file separator, group 
separator, record separator, and unit separator to be white-space delimiters. 
This disagrees with [1], which says it should be limited to space and 
horizontal tab, like CreateProcess. Let's test this as well:

def get_msvc_argv_delims():
template = '"{}" -c "import sys;print(len(sys.argv))" test{}space'
delims = []
for space in space_chars:
cmdline = template.format(sys.executable, space)
out = subprocess.check_output(cmdline)
argc = int(out)
if argc > 2:
delims.append(space)
return delims


>>> get_msvc_argv_delims()
['\t', ' ']

Apparently CommandLineToArgvW is inconsistent with the C runtime in this case.

On my Windows 10 system, ideographic space (U+3000) is not generally a 
command-line delimiter. That's not to say that some applications (and maybe 
localized CRTs?) don't use it that way. But I don't think it's the place of the 
subprocess module to handle it.

[1]: https://msdn.microsoft.com/en-us/library/17w5ykft

--
nosy: +eryksun

___
Python tracker 

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



EuroPython 2017: Tickets are now available

2017-04-07 Thread Alexander Hendorf
You can now buy regular tickets 
for Europe’s largest Python conference.

After the early bird tickets sold out in just eight hours,
standard rate tickets are now available:

Student: EUR 130.- incl. VAT 
(only available for students and postdocs; please bring your student card)

Personal: EUR 375.- incl. VAT 
(for people enjoying Python from home)

Business: EUR 555.- excl. VAT / 677.10 incl. VAT 
(for people using Python to make a living)

Tickets can be purchased via the EuroPython website.
https://ep2017.europython.eu/en/registration/buy-tickets/

Please help us spreading the news by forwarding this mail 
or re-tweeting, thanks!
https://twitter.com/europython/status/850368483061846018


Enjoy,

EuroPython 2017 Team
http://ep2017.europython.eu/
http://www.europython-society.org/


PS: please remember to submit your proposals for the conference. 
https://ep2017.europython.eu/en/call-for-proposals/
There are only a few days left for submission. 
The deadline is (Easter) Sunday, April 16th.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issues downloading python.

2017-04-07 Thread mm0fmf

On 07/04/2017 15:57, Brandon Mace wrote:

I have downloaded python onto a DELL laptop, but it will not run. I have
tried to install it multiple times but each time it does not work so I try
again. This time it has come up with a system error and that "The program
can't start because api-ms-win-crt-runtime-[1-1-0.dlll is missing"
What can I do to make the program run?



Install the missing file.

https://support.microsoft.com/en-us/kb/2999226
--
https://mail.python.org/mailman/listinfo/python-list


[issue29958] Use add_mutually_exclusive_group(required=True) in zipfile and tarfile CLI

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue29958] Use add_mutually_exclusive_group(required=True) in zipfile and tarfile CLI

2017-04-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 150cd1916a59e750ce88c65325de9ef0c42c6cb5 by Serhiy Storchaka in 
branch 'master':
bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944)
https://github.com/python/cpython/commit/150cd1916a59e750ce88c65325de9ef0c42c6cb5


--

___
Python tracker 

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



[issue29839] Avoid raising OverflowError in len() when __len__() returns negative large value

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29838] Check that sq_length and mq_length return non-negative result

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



Re: ANN: pyftpdlib 1.5.2 released

2017-04-07 Thread Jack Jansen
It looks as though you posted this message with the “about” paragraph from a 
different library? I looked at the web site, and pyftpdlib indeed seems to be 
an ftp daemon, as the name suggests, not a system load package….

Regards,
Jack

> On 06 Apr 2017, at 13:06, Giampaolo Rodola'  wrote:
> 
> Hello all,
> I'm glad to announce the release of pyftpdlib 1.5.2:
> https://github.com/giampaolo/pyftpdlib
> 
> About
> =
> 
> pyftpdlib (process and system utilities) is a cross-platform library for
> retrieving information on running processes and system utilization (CPU,
> memory, disks, network) in Python. It is useful mainly for system
> monitoring, profiling and limiting process resources and management of
> running processes. It implements many functionalities offered by command
> line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free,
> nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It
> currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD and
> NetBSD, both 32-bit and 64-bit architectures, with Python versions from 2.6
> to 3.5 (users of Python 2.4 and 2.5 may use 2.1.3 version). PyPy is also
> known to work.
> 
> What's new
> ==
> 
> **Enhancements**
> 
> - #378: SSL security was improved by disabling SSLv2, SSLv3 and
> SSL_COMPRESSION
>  features. New TLS_FTPHandler's ssl_options class attribute was added.
> - #380: AbstractedFS.listdir() can now return also a generator (not only a
>  list).
> 
> **Bug fixes**
> 
> - #367: ThreadedFTPServer no longer hangs if close_all() is called.
> - #394: ETIMEDOUT is not treated as an alias for "connection lost".
> - #400: QUIT can raise KeyError in case the user hasn't logged in yet and
> sends
>  QUIT command.
> 
> Links
> =
> 
> - Home page: https://github.com/giampaolo/pyftpdlib
> - Download: https://pypi.python.org/pypi/pyftpdlib
> - Documentation: http://pythonhosted.org/pyftpdlib
> - What's new: https://github.com/giampaolo/pyftpdlib/blob/master/HISTORY.rst
> 
> --
> 
> Giampaolo - http://grodola.blogspot.com
> -- 
> https://mail.python.org/mailman/listinfo/python-announce-list
> 
>Support the Python Software Foundation:
>http://www.python.org/psf/donations/

--
Jack Jansen, , http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman



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


Issues downloading python.

2017-04-07 Thread Brandon Mace
I have downloaded python onto a DELL laptop, but it will not run. I have
tried to install it multiple times but each time it does not work so I try
again. This time it has come up with a system error and that "The program
can't start because api-ms-win-crt-runtime-[1-1-0.dlll is missing"
What can I do to make the program run?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-07 Thread Jeremy Heiner

Changes by Jeremy Heiner :


--
title: zlib -> zlib.error: Error -2 while flushing: inconsistent stream state

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue30017] zlib

2017-04-07 Thread Jeremy Heiner

New submission from Jeremy Heiner:

I had some statements inside a `with` statement to write data to an entry in a
ZipFile. It worked great. I added a second `with` statement containing almost
exactly the same statements. That still worked great.

I refactored those common statements into a function and called that function
from the two `with` statements... and got an exception:

  zlib.error: Error -2 while flushing: inconsistent stream state

I can't figure out why it matters whether the writing happens in the `with` or
in the function called by the `with`, but here's a trimmed-down version of the
code that demonstrates the problem:


#!/usr/bin/env python

import io, pprint, zipfile
from zipfile import ZIP_DEFLATED

def printLiteral( data, out ) :
encoder = io.TextIOWrapper( out, encoding='utf-8', write_through=True )
pprint.pprint( data, stream=encoder )

data = { 'not' : 'much', 'just' : 'some K \N{RIGHTWARDS WHITE ARROW} V pairs' }

with zipfile.ZipFile( 'zzz.zip', mode='w', compression=ZIP_DEFLATED ) as myzip :

with myzip.open( 'this one works', 'w' ) as out :
encoder = io.TextIOWrapper( out, encoding='utf-8', write_through=True )
pprint.pprint( data, stream=encoder )

with myzip.open( 'this one fails', 'w' ) as out :
printLiteral( data, out )

print( 'printed but entry still open' )
print( 'entry has been closed but not file' )
print( 'zip file has been closed' )


And here's the output on my Arch Linux 64bit with package `python 3.6.0-2`...
A co-worker sees the same behavior on MacOS 10.11.6 Python 3.6.1 :


printed but entry still open
Traceback (most recent call last):
  File "zzz.py", line 21, in 
print( 'printed but entry still open' )
  File "/usr/lib/python3.6/zipfile.py", line 995, in close
buf = self._compressor.flush()
zlib.error: Error -2 while flushing: inconsistent stream state


I tried debugging this in PyDev but got lost. Turning off the compression makes
the exception go away.

--
messages: 291275
nosy: Jeremy Heiner
priority: normal
severity: normal
status: open
title: zlib
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



[issue27585] asyncio.Lock deadlock after cancellation

2017-04-07 Thread Mathieu Sornay

Changes by Mathieu Sornay :


--
pull_requests: +1188

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

> The idea is to reuse _BaseSelectorImpl.register() and
> _BaseSelectorImpl.unregister() to factorize the code.

You can't factorize the logic of modify() into those as they do two different 
things. I also don't like repeating the same thing 3 times but given how the 
module is organized I'm not sure how to do that as I need to pass 3 things 
around: the low-level selector (epoll, poll, whatever) and the read and write 
constants (POLLIN, EPOLLIN) which change depending on the selector being used.
The same thing applies to the devpoll class (http://bugs.python.org/issue18931).
I can write a second patch which to refactor the whole module if that is 
desirable but I prefer to do that in another PR.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

> Doesn't that mean doing 3 operations (unregister(), register(), modify()) 
> instead of the current 2 (unregister(), register())? I don't see how it can 
> be faster than a single modify() syscall.

The idea is to reuse _BaseSelectorImpl.register() and 
_BaseSelectorImpl.unregister() to factorize the code. These methods don't use 
syscall, they create the SelectorKey object and update _fd_to_key. So each 
class doesn't have to redo these things.

I don't insist to redo what I did, I'm just trying to explain my change because 
your change basically copy/paste the same code 3 times, and you forgot 
KqueueSelector, so you even may have to copy it a 4th time ;-)

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

> My patch calls generic unregister() and register() of the base
> classes, but it only uses one syscall per modify() call.

Doesn't that mean doing 3 operations (unregister(), register(), modify()) 
instead of the current 2 (unregister(), register())? I don't see how it can be 
faster than a single modify() syscall.

> Oh by the way, it seems like my patch changes KqueueSelector, 
> but your change doesn't. Am I right?

You are right but it looks like you end up doing the same thing as unregister() 
and register(). kqueue() has no modify() method so I don't think it can benefit 
from this change.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 1.5x

2017-04-07 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Speedup DefaultSelectors.modify() by 2x -> Speedup 
DefaultSelectors.modify() by 1.5x

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

Giampaolo Rodola': "Your old patch uses unregister() and register() so I'm not 
sure what speedup that'll take as the whole point is to avoid doing that."

My patch calls generic unregister() and register() of the base classes, but it 
only uses one syscall per modify() call.

Oh by the way, it seems like my patch changes KqueueSelector, but your change 
doesn't. Am I right? KqueueSelector is the default selector on FreeBSD and 
macOS. IMHO it's worth it to optimize it as well.

--

___
Python tracker 

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



Re: PYTHON

2017-04-07 Thread Mario R. Osorio
On Thursday, April 6, 2017 at 8:43:48 AM UTC-4, alders...@gmail.com wrote:
> Hello, how can I start programming?

http://www.lmgtfy.com/?q=Hello%2C+how+can+I+start+programming%3F
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

@neologix: Do you have a GitHub account? It's hard to me to see if 
https://github.com/neologix is you or not, and your GitHub username is not 
filled in the Bug Tracker database.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

PR: https://github.com/python/cpython/pull/1030

--
pull_requests: +1187

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Hey Stinner, thanks for chiming in! Your old patch uses unregister() and 
register() so I'm not sure what speedup that'll take as the whole point is to 
avoid doing that. You may want to rewrite it and benchmark it but it looks like 
it'll be slower.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

@Giampaolo Rodola: CPython development moved to GitHub, can you please create a 
pull request instead of a patch? Thank you.
https://docs.python.org/devguide/pullrequest.html

Hum, I see that my old patch of issue #18932 
(selectors_optimize_modify-2.patch) is different. I tried to factorize code. 
What do you think of my change?

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread STINNER Victor

STINNER Victor added the comment:

Hi Giampaolo Rodola'! It seems like you proposed the same idea 4 years ago and 
I wrote a similar patch: issue #18932 :-)

I suggest you to use my perf module to produce more reliable benchmarks. Here 
is my results on my computer smithers tuned for benchmarks:

haypo@smithers$ ./python bench_selectors.py -o ref.json
[apply the patch]
haypo@smithers$ ./python bench_selectors.py -o patch.json
haypo@smithers$ ./python -m perf compare_to ref.json patch.json  --table
+--+-+--+
| Benchmark| ref | patch|
+==+=+==+
| PollSelector.modify  | 11.3 us | 8.22 us: 1.37x faster (-27%) |
+--+-+--+
| EpollSelector.modify | 13.5 us | 8.88 us: 1.52x faster (-34%) |
+--+-+--+

Not significant (1): SelectSelector.modify


@neologix: "Hm, do you have a realistic benchmark which would show the benefit?"

I don't think that selector.modify() can be a bottleneck, but IMHO the change 
is simple and safe enough to be worth it. In a network server with 10k client, 
an optimization making .modify() 1.52x faster is welcomed.

--
Added file: http://bugs.python.org/file46789/bench_selectors_modify.py

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

modify() can be used often in verbose protocols such as FTP and SMTP where a 
lot of requests and responses are continuously exchanged between client and 
server, so you need to switch from EVENT_READ to EVENT_WRITE all the time. I 
did a similar change some years ago in pyftpdlib but I don't have another 
benchmark other than this one.

--

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Charles-François Natali

Charles-François Natali added the comment:

Hm, do you have a realistic benchmark which would show the benefit?
Because this is really a micro-benchmark, and I'm not convinced that
Selector.modify() is a significant bottleneck in a real-world
application.

--

___
Python tracker 

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



Call For Participation for the 2017 Python Language Summit

2017-04-07 Thread Larry Hastings


The 2017 Python Language Summit is coming!

The Python Language Summit is an annual day-long meeting of CPython core 
developers.  It’s a highly technical meeting, designed to explore and 
resolve existing discussions regarding the Python programming language, 
the development of its reference implementation CPython, and the impact 
of the language’s evolution on the existing alternative 
implementations.  It’s a once-a-year opportunity for Python’s core 
development team to get together in a room and work things out.


The meeting is kept small on purpose, as we think that maximizes its 
productivity and effectiveness.  Nearly all attendees are CPython core 
developers, but we do accept presentations from anyone in the greater 
Python community who has something interesting to say to the core 
developers.  And that could be you!


In order to be eligible, you must be able to attend the Summit in 
person.  The Summit will be held May 17 2017, all day, in the same 
convention center where PyCon itself is held.  You have to get there 
yourself; we literally have no discretionary budget to help people 
attend the Summit.  However, you don’t have to buy a ticket to PyCon in 
order to attend the summit--it’s a completely separate event, and it’s free!


But mere eligibility is not enough.  The presentations are carefully 
hand-picked by the Language Summit organizers, and must be exceedingly 
relevant and of high quality in order to be considered. The Summit only 
comes once a year, and we the organizers want to keep it interesting and 
maximally productive for the developers who are kind enough to attend.  
To be brutally honest, we expect most proposals from non-core-developers 
will be turned down--again, sorry.


PyCon is large, diverse, welcoming, and vibrant, and there are lots of 
great avenues (e.g. lightning talks, BoFs, open spaces, etc.) for 
discussing Python-related topics.  If your proposed talk isn't accepted 
for the Language Summit, we highly encourage you to explore these other 
options.



Here are the criteria you should keep in mind if you submit a presentation:

 * Is this a question about the *design* of Python?  Or, to a lesser
   extent, the implementation of CPython or one of the alternative
   implementations?  The Summit is about Python itself--we don’t
   discuss other projects.
 * Is this a *technical* debate?  The Python universe is large and
   diverse, but the Summit is explicitly a highly technical meeting,
   and a deeper technical context on the part of participants is essential.
 * Is this topic going to spark conversation?  A good rule of thumb:
   your presentation should raise questions, not provide answers.  If
   your topic could be adequately covered in a blog post, it’s probably
   not interactive enough.
 * Is this already an ongoing discussion in the Python development
   community?  As a rule the Language Summit is not a venue for new
   business--it’s for working through existing technical debates.
 * Is this topic going to be interesting to a lot of people? While it
   doesn’t have to be universally interesting, it can’t be too narrow
   either.  As a rule, most people in the room should be interested.
 * Is this a topic that’s still considered "open" by the core
   developers?  There’s no point in proposing a talk saying "you should
   abandon Python 3 and go back to 2", or even "you should make a
   Python 2.8".  From the perspective of the core developers, these are
   resolved, closed issues.


Examples of interesting topics:

 * Python’s new async syntax is flawed, here’s why
 * The design of CPython’s extension API makes it difficult to do what
   we want it to do
 * My patch for CPython makes it ten times faster for common workloads
 * I’m engaged in a lively and long-lived discussion on python-dev and
   I want to bring it up with the core devs in person, so that a
   resolution can be found


Examples of irrelevant / uninteresting / ineligible topics:

 * A useful Python library you want people to know about
 * A new language feature you want to propose
 * There’s a bug in CPython you want to raise awareness about
 * The Python community needs to...


The process for submitting a talk proposal is exactly the same as for 
core developers: fill out the Google form with your contact information, 
your affiliation, and a summary of your proposal.  The form is reachable 
via the Language Summit page under the PyCon events menu:


   https://us.pycon.org/2017/events/language-summit/

Since this wider call for proposals comes so late in the process, we’re 
extending the deadline for submissions.  The deadline is now Thursday, 
April 20th, 2017, two weeks from today.  If your submission is accepted, 
we will notify you by May 1st.


Finally, even if you don’t get to attend, stay tuned to Linux Weekly 
News (LWN) in the days and weeks following the Language Summit. Jake 
Edge from LWN has done a fantastic job of reporting on the Language 
Summit the previous 

[issue30016] No sideways scrolling in IDLE

2017-04-07 Thread Jensen Taylor

New submission from Jensen Taylor:

This has been a bug since 2.7 as far as I know.

--
assignee: terry.reedy
components: IDLE
messages: 291263
nosy: Jensen Taylor, terry.reedy
priority: normal
severity: normal
status: open
title: No sideways scrolling in IDLE
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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1186

___
Python tracker 

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



[issue30015] Windows also treats full-width spaces as a delimiter when parsing arguments

2017-04-07 Thread 林建佑

New submission from 林建佑:

Windows also treats full-width spaces as a delimiter when parsing command line 
arguments.

Therefore, subprocess.run() and subprocess.Popen() also need to quote the arg 
in the sequence of arguments if there is any full-width spaces in it.

Example:

>> subprocess.run(['foo', 'half-width space', 'full-width space'])

should be executed as 
>> foo "half-width space" "full-width space"
Windows will treat it as 3 arguments

but now it is incorrectly executed as 
>> foo "half-width space" full-width space
Windows will treat it as 4 arguments

--
components: Library (Lib), Windows
messages: 291262
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 林建佑
priority: normal
severity: normal
status: open
title: Windows also treats full-width spaces as a delimiter when parsing 
arguments
type: behavior
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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
components: +Library (Lib), asyncio
stage:  -> patch review
type:  -> performance

___
Python tracker 

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



django float round tripping

2017-04-07 Thread Robin Becker

I've been having problems with django FloatFields not round tripping properly; 
eg

field = 0.018903438896219302

gets saved and returns as

0.0189034388962193

It turns out that this is a property of the MySQLdb python interface where in 
converter.py we have the definition


def Float2Str(o, d):
return '%.15g' % o

if I change this to

def Float2Str(o, d):
return repr(o)

I do seem able to get reproducibility.

Are there any downsides to making this change?
--
Robin Becker

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


[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +gvanrossum, haypo, neologix, yselivanov

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
versions: +Python 3.7
Added file: http://bugs.python.org/file46788/bench.py

___
Python tracker 

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



[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-07 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

Patch in attachment modifies DefaultSelector.modify() so that it uses the 
underlying selector's modify() method instead of unregister() and register() 
resulting in a 2x speedup.

Without patch:
~/svn/cpython {master}$ ./python bench.py 
0.006010770797729492

With patch:
~/svn/cpython {master}$ ./python bench.py 
0.00330352783203125

--
files: selectors_modify.diff
keywords: patch
messages: 291261
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: Speedup DefaultSelectors.modify() by 2x
Added file: http://bugs.python.org/file46787/selectors_modify.diff

___
Python tracker 

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



[issue29549] Improve docstring for str.index

2017-04-07 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +1185

___
Python tracker 

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



Re: A Python solution for turning a web page into Pandas DataFrame table

2017-04-07 Thread Steve D'Aprano
On Fri, 7 Apr 2017 07:08 pm, David Shi wrote:

> 
> 
> Is there a Python solution for turning a web page into Pandas DataFrame
> table? Looking forward to hearing from you.

What, *any* web page? Like this?

http://www.math.ubc.ca/~cass/courses/m308-03b/projects-03b/skinner/ex-dimension-sierpinski_gasket.htm



What exactly would you expect to go into the dataframe?


I think you need to be more specific. What web page, containing what sort of
data, and what do you expect to get out of it?


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue30013] Compiler warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1184

___
Python tracker 

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



[issue30013] Compiler warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

Changes by Louie Lu :


--
title: Compiling warning in Modules/posixmodule.c -> Compiler warning in 
Modules/posixmodule.c

___
Python tracker 

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



[issue30013] Compiling warning in Modules/posixmodule.c

2017-04-07 Thread Louie Lu

New submission from Louie Lu:

Using gcc-6.3.1 20170306 on Linux 4.10.1, it gave the warning:

gcc -pthread -c -Wno-unused-result -Wsign-compare -g -Og -Wall 
-Wstrict-prototypes-std=c99 -Wextra -Wno-unused-result 
-Wno-unused-parameter -Wno-missing-field-initializers 
-Werror=implicit-function-declaration   -I. -I./Include-DPy_BUILD_CORE -o 
Python/pyctype.o Python/pyctype.c
:./Modules/posixmodule.c: In function ‘os_major_impl’:
./Modules/posixmodule.c:8584:13: warning: In the GNU C Library, "major" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "major", include 
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including .
 return major(device);
 ^  



 
./Modules/posixmodule.c: In function ‘os_minor_impl’:
./Modules/posixmodule.c:8601:13: warning: In the GNU C Library, "minor" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "minor", include 
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including .
 return minor(device);
 ^  



 
./Modules/posixmodule.c: In function ‘os_makedev_impl’:
./Modules/posixmodule.c:8619:13: warning: In the GNU C Library, "makedev" is 
defined
 by . For historical compatibility, it is
 currently defined by  as well, but we plan to
 remove this soon. To use "makedev", include 
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including .
 return makedev(major, minor);
 ^  


The problem introduce in glibc 2.25, going to deprecate the definition of 
'major', 'minor', and 'makedev' by  sys/types.h. And the autoconf didn't change 
the behavior of `AC_HEADER_MAJOR`, see:

https://lists.gnu.org/archive/html/autoconf/2016-08/msg00014.html


There is a workaround path for this in libvirt, which take from autoconf patch, 
see:

https://www.redhat.com/archives/libvir-list/2016-September/msg00459.html

--
components: Extension Modules
messages: 291260
nosy: louielu
priority: normal
severity: normal
status: open
title: Compiling warning in Modules/posixmodule.c
type: compile error
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



  1   2   >