[issue32381] Python 3.6 cannot reopen .pyc file with non-ASCII path

2017-12-19 Thread Eryk Sun

Eryk Sun  added the comment:

run_file encodes the file path via PyUnicode_EncodeFSDefault, which encodes as 
UTF-8 in Windows, starting with 3.6. PyRun_SimpleFileExFlags subsequently tries 
to open this encoded path via _Py_fopen, which calls fopen. The CRT expects an 
ANSI encoded path, so only the common ASCII subset will work. Non-ASCII paths 
will fail.

This could be addressed in _Py_fopen by decoding the path and calling _wfopen 
instead of fopen. 

Executing a .pyc also fails in 3.5 if the wide-character path can't be encoded 
as ANSI, but the 3.5 branch only accepts security fixes.

--
components: +Interpreter Core, Unicode
nosy: +eryksun, ezio.melotti, vstinner
stage:  -> test needed
title: python3.6 can not reopen .pyc file with Chinese path -> Python 3.6 
cannot reopen .pyc file with non-ASCII path
type: compile error -> 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



[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-19 Thread Марк Коренберг

Марк Коренберг  added the comment:

Note, TCP_NODELAY can not be set on UNIX streaming socket. Do you have 
corresponding tests for UNIX sockets ?

--

___
Python tracker 

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



[issue32381] python3.6 can not reopen .pyc file with Chinese path

2017-12-19 Thread tianjg

New submission from tianjg :

have a problem that python3.6 can not reopen .pyc file with Chinese path, and 
python3.5 can reopen the same pyc file. As shown in the picture

--
components: Windows
files: 20171218111240.jpg
messages: 308705
nosy: paul.moore, steve.dower, tianjg, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: python3.6 can not reopen .pyc file with Chinese path
type: compile error
versions: Python 3.6
Added file: https://bugs.python.org/file47341/20171218111240.jpg

___
Python tracker 

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



[META] Are the list admins honouring Posting Prohibited demands?

2017-12-19 Thread Steve D'Aprano
This is possibly a question for the list admins...

I notice that Lawrence D’Oliveiro has taken up labelling his posts with a
demand that his posts are not to be posted to the Python-List mailing list.

I also see that his posts are not showing up on the mailing list archive. Is
this a coincidence or a direct consequence of his demand?


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


[issue32204] async/await performance is very low

2017-12-19 Thread Liran Nuna

Liran Nuna  added the comment:

Yuri, Those speed improvements are awesome and I'm really excited about them, 
performance is slowly starting to match asynq and would make us migrating our 
code to async/await more feasable!

Today, python3.6.4 was released and these performance improvements did not make 
it in this version.

I'm not familiar with python's release processes , what are the steps or time 
line for these to be backported to 3.6 and released on next minor version as to 
avoid a lengthy wait for python3.7?

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Camion

Camion  added the comment:

What I mean is that we need to clarify (by giving examples ?) what make the 
scope for the new binding "not be unambiguously decidable", because, for an 
example : My example is totaly unambiguously decidable for an interpreter. It's 
for a human reader that it might lead to mistakes.

--

___
Python tracker 

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



[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

Yes, if that protocol existed the errors would be clearer.  But it doesn't, for 
historical reasons, and that is unlikely to change.

You are welcome to submit an enhancement request to make quopri accept string 
as an argument when decoding.  But when encoding, it must produce bytes, 
because "ASCII" is a *byte* encoding, not a unicode encoding (unicode is ascii 
compatible, but it is neither ascii nor bytes).  You might have to write the PR 
yourself, I'm not sure if anyone else will be interested (but some of the 
people on the core-mentorship mailing list might be).

StringIO is specifically designed to only operate on strings.  If you want to 
decode the bytes you feed it, you have to do that.  This is an intentional 
design.

Further discussion of ways to improve the situation should move to the 
python-idea mailing list.  There's really nothing to do here from a bug tracker 
perspective, unless you want to open an enhancement request as mentioned above.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4828

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Camion

Camion  added the comment:

Ivan, 

I believe, this sentence : "(the scope in which a new binding should be created 
cannot be determined unambiguously)" in 
https://docs.python.org/fr/3/reference/simple_stmts.html#nonlocal, is the one 
which should be clarified first, and then this would probably give the bases to 
improve the error message.
It raises the following concerns : 
  1/ Is it me or there is a nasty double negation in this sentence which make 
it tell the contrary of what it should ?
  2/ What are the conditions which would make such an ambiguity appear ? I 
wonder what the persons who wrote this had on their mind when they wrote it, 
but in regard with code reading/reviewing, my original example might be an 
example of such an ambiguous situation. Now the question is: are there others 
and what would they look like ?

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

I like the new shape of Py_Main(). The main parts of Py_Main() are now well 
identified:

* init "cmdline"
* init "python core"
* init "python main"
* run python
* cleanup

--

___
Python tracker 

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



Re: [OT] Python and Excel

2017-12-19 Thread Thomas Jollans
On 2017-12-18 20:16, MRAB wrote:
> Those who use Excel might find this interesting:
> 
> Microsoft Considers Adding Python as an Official Scripting Language to
> Excel
> https://www.bleepingcomputer.com/news/microsoft/microsoft-considers-adding-python-as-an-official-scripting-language-to-excel/
> 

I don't use Excel, but if this happens it could be really good news for
IronPython.


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


[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread Alexey Luchko

Alexey Luchko  added the comment:

1. On quopri.

It is counter-intuitive despite the clear statement in the doc-string. 
Quoted-printable is used mostly for text encoding. (It would be quite awkward 
and inefficient to use it for binary data.)

My case: I have a text and I mean to get a text. Why on earth StringIO is not 
suitable for this goal... It is just crazy!


2. On duck typing and StringIO.

It should make life easy, not crazy. But with great power... You know.

Taking a wider look than just quopri, the case shows a problem – writing text 
to StringIO produces a type error stating *string argument expected*.
That is crazy and as counter-duck-typing as type checking.
And even more ... crazy in case of 7bit ascii!

There could be a solution on StringIO side, like an encoding it should expect 
on input if it gets binary data. At least 7bit ascii would be totally ok for 
default it this case.
Then it either would have worked or would have produced a clear text encoding 
related error that would be *meaningful* and *instructive*.


3. On protocol.

A protocol: write_bytes() and write_string() methods that would have been 
raising type error in case of text_file.write_bytes() or 
binary_file.write_string().
Then one having bytes-*like* object (like quopri.decode) would call 
write_bytes() and StringIO would raise smth like 'StringIO used for binary 
output, consider BytesIO' or 'Text file requires strings, not bytes' that would 
be meaningful as well.
Other one having string-*like* object would call knowingly write_string() with 
a corresponding error from BytesIO or binary file.

*There is nothing of checking in the protocol, but clear intention statement.*

Disclaimer:
  It is just an example and an opinion. There is no reason for holy war.
  I don't pretend it would be any better...

--

___
Python tracker 

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



[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2017-12-19 Thread Eric Snow

Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 19760863623b636a63ccf649107d9504c6465a92 by Victor Stinner in 
branch 'master':
bpo-32030: Cleanup pymain_main() (#4935)
https://github.com/python/cpython/commit/19760863623b636a63ccf649107d9504c6465a92


--

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

It might be possible to create ProcessPoolExecutor and get it to spawn all the 
workers *before* you start the asyncio loop. It looks like ProcessPoolExecutor 
delays spawning workers until the first piece of work is submitted, but at that 
point it spawns all of them immediately, so something like this might work:

executor = ProcessPoolExecutor(...)
executor.submit(lambda: None).wait()
with asyncio.get_event_loop() as loop:
loop.run_until_complete(...)

--

___
Python tracker 

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



[issue32375] Compilation warnings with gcc

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:797:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^

Line 797:

wcsncpy(calculate->zip_path, prefix, MAXPATHLEN);

calculate type is "PyCalculatePath *" which is defined as:

typedef struct {
...
wchar_t zip_path[MAXPATHLEN+1];/* ".../lib/pythonXY.zip" */
...
} PyCalculatePath;

Earlier, all bytes are set to 0:

memset(, 0, sizeof(calculate));

So I don't see how wcsncpy() can overflow.


By the way, I'm unable to reproduce the warning on Fedora 27 with GCC 7.2.1. 
Are you using -D_FORTIFY_SOURCE=1? Are you compiling Python in release mode? 
Can you try to find the command line compiling getpath.c?

--

___
Python tracker 

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



Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Has any thought been given to adding elif to the for statement?


Time machine at work I think:

https://docs.python.org/3/reference/compound_stmts.html#the-if-statement

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


Re: adding elif to for

2017-12-19 Thread Skip Montanaro
Apologies. Misread your question.

Skip

On Dec 19, 2017 6:16 PM, "Skip Montanaro"  wrote:

>
> Has any thought been given to adding elif to the for statement?
>
>
> Time machine at work I think:
>
> https://docs.python.org/3/reference/compound_stmts.html#the-if-statement
>
> Skip
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: adding elif to for

2017-12-19 Thread Bill

bob gailer wrote:

Has any thought been given to adding elif to the for statement?


I don't think it is a good idea because it needlessly, from my point of 
view, embeds too much complexity into a single construct (making it more 
difficult to maintain, for instance). That's what language designer's do 
though--they kick ideas like that around.  If you have a great idea, 
maybe propose a new language.




for x in foo:
if y: break
elif a==b:
something
else:
something else

as a shortcut to:
for x in foo:
if y: break
else:
if a==b:
something
else:
something else
bob gailer


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


[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4827

___
Python tracker 

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



adding elif to for

2017-12-19 Thread bob gailer

Has any thought been given to adding elif to the for statement?

for x in foo:
    if y: break
elif a==b:
    something
else:
    something else

as a shortcut to:
for x in foo:
    if y: break
else:
    if a==b:
    something
else:
    something else
bob gailer
--
https://mail.python.org/mailman/listinfo/python-list


[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Stefan, your last example is formally speaking OK, if one reads the "Execution 
model" literally. The original example is however too ambiguous, so it is good 
that it triggers an error.

I think there is a chance to improve the error message here, but I didn't think 
about this carefully (in particular, a situation where `global` appears after 
the inner function `h` definition worries me).

--

___
Python tracker 

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



[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

That's type checking.  Not type checking is to call the method that writes the 
data, expecting the object to handle the bytes it is passed, and then that 
object raises an error to indicate that it cannot.  There is no protocol that 
can be checked for.

--

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

It appears the the timeouts situation is a bit more complex.  It's perfectly 
normal for a Python socket object to be in a "blocking" mode and for its FD to 
be in a non-blocking mode.  Read more about this in the latest docs update to 
the PR: 
https://github.com/python/cpython/pull/4926/commits/adcc91f93e1538f0d25645ebe0285b12137a3e3b

--

___
Python tracker 

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



[issue32268] quopri.decode(): string argument expected, got 'bytes'

2017-12-19 Thread Alexey Luchko

Alexey Luchko  added the comment:

I didn't mean type checking. The point is that since string and bytes are 
different types, then binary and text files are actually much more different 
than before python 3. Therefore they better be of different protocols.
Then inside quopri with StringIO in place of BytesIO the error would be much 
more clear and this issue would not have appeared.
This would be helpful in lack of one's intuition, like with newcomers.

--

___
Python tracker 

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



Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread Steve D'Aprano
On Wed, 20 Dec 2017 07:23 am, namenobodywa...@gmail.com wrote:

> On Monday, December 18, 2017 at 10:16:07 PM UTC-8, Terry Reedy wrote:
> 
>> Where or how have you looked so far?  How formal do you want?
> 
> i want full-on formal with lots of rigor and every possible detail spelled
> out; i've looked in a couple of books but my best lead so far is a paper by
> knuth called "an analysis of alpha-beta pruning" - what i need is along
> those lines but with just a few more of the details spelled out

Does this have anything specifically to do with Python programming?

If not, why are you asking here? Do you think that Python programmers are
especially well-known for their hard-core formal academic methodology?

Have you tried searching on Google Scholar?

We're pretty accepting of off-topic posts here, especially when they evolve
naturally from an on-topic post. But in future, if you're going to *start* an
off-topic thread from the first post, it would be polite to label it such
with an "[OT]" or "Off-topic" prefix to the subject line.



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


[issue32304] Upload failed (400): Digests do not match on .tar.gz ending with x0d binary code

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I agree with the suggested fix.  Do you want to submit a PR?

--
nosy: +pitrou -llecaroz
stage:  -> needs patch
versions: +Python 3.6 -Python 3.5, Python 3.8

___
Python tracker 

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



[issue32345] EIO from write() is only fatal if print() contains a newline

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Python 2 doesn't call write(), it calls fwrite() and friends (i.e. it uses the 
libc's buffered I/O API).  Also we don't do anything special if the printed 
string has a newline in it.  So my guess is that it's a bug in the libc.

--
nosy: +pitrou

___
Python tracker 

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



[issue32315] can't run any scripts with 2.7.x, 32 and 64-bit

2017-12-19 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
resolution:  -> not a bug
stage: test needed -> 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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

In kernel logs (look at dmesg), I found two messages:

vstinner@apu$ journalctl -k|grep random
déc. 14 23:10:28 apu kernel: random: fast init done
déc. 14 23:10:32 apu kernel: random: crng init done

Sadly, I don't know which one means that urandom is initialized.

See also https://wiki.archlinux.org/index.php/Random_number_generation

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset c4bca951065f4b2b6833f6ce7a0721e863e2343e by Victor Stinner in 
branch 'master':
bpo-32030: Add _PyCoreConfig.argv (#4934)
https://github.com/python/cpython/commit/c4bca951065f4b2b6833f6ce7a0721e863e2343e


--

___
Python tracker 

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



Re: What is wrong with this regex for matching emails?

2017-12-19 Thread Random832
On Mon, Dec 18, 2017, at 02:01, Chris Angelico wrote:
> Hmm, is that true? I was under the impression that the quoting rules
> were impossible to match with a regex.  Or maybe it's just that they're
> impossible to match with a *standard* regex, but the extended
> implementations (including Python's, possibly) are able to match them?

What's impossible to match with a regex are the comments permitted by RFC822 
(which are delimited by balanced parentheses - AIUI perl can do it, python 
can't.) Which are, according to my argument, not part of the address.

> Anyhow, it is FAR from simple; and also, for the purpose of "detect
> email addresses in text documents", not desirable. Same as with URL
> detection - it's better to have a handful of weird cases that don't
> autolink correctly than to mis-detect any address that's at the end of
> a sentence, for instance. For that purpose, it's better to ignore the
> RFC and just craft a regex that matches *common* email address
> formats.

Email addresses don't, according to the formal spec, allow a dot at the end of 
the domain part. I was half-seriously proposing that as an extension (since DNS 
names *do*).
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32030] PEP 432: Rewrite Py_Main()

2017-12-19 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4826

___
Python tracker 

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



[issue32380] functools.singledispatch interacts poorly with methods

2017-12-19 Thread Ethan Smith

New submission from Ethan Smith :

Consider the following:

from functools import singledispatch

class Dispatch:
@singledispatch
def foo(self, a):
return a

@foo.register(int)
def _(self, a):
return "int"

@foo.register(str)
def _(self, a):
return "str"

cls = Dispatch()
cls.foo(3)  # 3
cls.foo('hm')  # 'hm'

I find this quite unintuitive. Essentially, since singledispatch dispatches 
based solely on a functions first argument, it is useless on methods unless one 
wraps it and modifies how it uses the internal wrapper function. I believe this 
should be relatively easy to fix with adding a check of inspect.ismethod and 
then modifying the number of the checked argument where appropriate.

I'm happy to write a patch if this change is seen as a good idea.

--
components: Library (Lib)
messages: 308687
nosy: Ethan Smith
priority: normal
severity: normal
status: open
title: functools.singledispatch interacts poorly with methods
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



Re: What is wrong with this regex for matching emails?

2017-12-19 Thread alister via Python-list
On Wed, 20 Dec 2017 08:21:02 +1100, Chris Angelico wrote:

> On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list
>  wrote:
>> On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:
>>> A more correct match would boil down to:
>>>
>>> * Match any printable Unicode characters (not just ASCII).
>>>
>>> * Locate the *last* ‘@’ character. (An email address may contain more
>>>   than one ‘@’ character; you should allow any printable ASCII
>>>   character in the local part.)
>>>
>>> * Match the domain part as the text after the last ‘@’ character.
>>> Match
>>>   the local part as anything before that character. Reject an address
>>>   that has either of these empty.
>>>
>>> * Validate the domain by DNS request. Your program is not an authority
>>>   for what domains are valid; the only authority for that is the DNS.
>>>
>>> * Don't validate the local part at all. Your program is not an
>>> authority
>>>   for what local parts are accepted to the destination host; the only
>>>   authority for that is the destination mail host.
>>
>> At which point you have basicaly boiled your test down to
>> @. which is rather pointless
> 
> Not quite. Firstly, I would exclude all whitespace from your matchable
> characters; even though technically you CAN have spaces in email
> addresses, that'll almost never happen, and it's a lot more common to
> delimit with whites. Secondly, there's actually no requirement to have a
> dot in the domain part (and Ben never said so). However, you can
> straight-forwardly validate the domain by attempting a lookup.
> 
> rosuav@sikorsky:~$ dig +short mx ntlworld.com 1
> mx.tb.ukmail.iss.as9143.net.
> 1 mx.mnd.ukmail.iss.as9143.net.
> rosuav@sikorsky:~$ dig +short mx benfinney.id.au 10
> in1-smtp.messagingengine.com.
> 20 in2-smtp.messagingengine.com.
> rosuav@sikorsky:~$ dig +short mx dud.example.off.rosuav.com
> rosuav@sikorsky:~$
> 
> If there are no MX records for a domain, either the domain doesn't
> exist, or it doesn't receive mail. (Remove the "+short" for a more
> verbose report, in which case the failure state is a return code of
> NXDOMAIN.)
> 
>> there are only 2 reasons why you would want an email anyway
>>
>> 1) Data mining, just to add to your mailing list- in which case even if
>> it validates you still don't know if it is a fake address to prevent
>> spam so validating is pointless
>>
>> 2) it is part of a registration process, in which case if it is
>> incorrect the registration email will not be received & registration
>> cannot be completed so self validating without any effort.
> 
> 3) You're building a text display system (forum posts, text chat, etc,
> etc) and want to have web links and email addresses automatically become
> clickable
possible but again if people making the posts want to be contacted & will 
list a working email address, more likely it will be munged to stop the 
spammers from harvesting it. otherwise if an emaikl has to be given they 
will provide a valid looking fake.
> 
> 4) You ask a user to provide "contact information". If s/he provides an
> email address, you automatically send emails; if a phone number, you
> automatically send SMS/text messages; otherwise, you leave it up to a
> human to contact the user.
> 
I can see auto detecting between a Tel no & an email may be a plausible 
desire, you now have 2 problems because not only are email address so 
difficult to validate that it is not worth the effort telephone numbers 
are also to variable to validate reliably (assuming an international 
audience)

> Plenty of possibilities beyond those two. Don't assume there's nothing
> else that can be done just because your imagination can't come up with
> anything :)

Indeed the most obvious other reason is scraping web pages Newsgroups & 
forums for email addresses to spam & I am sure no-one wants to help with 
that

> 
> ChrisA





-- 
I know you believe you understand what you think this fortune says, but
I'm not sure you realize that what you are reading is not what it means.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30697] segfault in PyErr_NormalizeException() after memory exhaustion

2017-12-19 Thread Brett Cannon

Brett Cannon  added the comment:

Re-opened as a release blocker to make sure we're okay with the potential ABI 
breakage.

--
nosy: +ned.deily
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



Re: What is wrong with this regex for matching emails?

2017-12-19 Thread Chris Angelico
On Wed, Dec 20, 2017 at 7:21 AM, alister via Python-list
 wrote:
> On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:
>> A more correct match would boil down to:
>>
>> * Match any printable Unicode characters (not just ASCII).
>>
>> * Locate the *last* ‘@’ character. (An email address may contain more
>>   than one ‘@’ character; you should allow any printable ASCII character
>>   in the local part.)
>>
>> * Match the domain part as the text after the last ‘@’ character. Match
>>   the local part as anything before that character. Reject an address
>>   that has either of these empty.
>>
>> * Validate the domain by DNS request. Your program is not an authority
>>   for what domains are valid; the only authority for that is the DNS.
>>
>> * Don't validate the local part at all. Your program is not an authority
>>   for what local parts are accepted to the destination host; the only
>>   authority for that is the destination mail host.
>
> At which point you have basicaly boiled your test down to
> @. which is rather pointless

Not quite. Firstly, I would exclude all whitespace from your matchable
characters; even though technically you CAN have spaces in email
addresses, that'll almost never happen, and it's a lot more common to
delimit with whites. Secondly, there's actually no requirement to have
a dot in the domain part (and Ben never said so). However, you can
straight-forwardly validate the domain by attempting a lookup.

rosuav@sikorsky:~$ dig +short mx ntlworld.com
1 mx.tb.ukmail.iss.as9143.net.
1 mx.mnd.ukmail.iss.as9143.net.
rosuav@sikorsky:~$ dig +short mx benfinney.id.au
10 in1-smtp.messagingengine.com.
20 in2-smtp.messagingengine.com.
rosuav@sikorsky:~$ dig +short mx dud.example.off.rosuav.com
rosuav@sikorsky:~$

If there are no MX records for a domain, either the domain doesn't
exist, or it doesn't receive mail. (Remove the "+short" for a more
verbose report, in which case the failure state is a return code of
NXDOMAIN.)

> there are only 2 reasons why you would want an email anyway
>
> 1) Data mining, just to add to your mailing list- in which case even if
> it validates you still don't know if it is a fake address to prevent spam
> so validating is pointless
>
> 2) it is part of a registration process, in which case if it is incorrect
> the registration email will not be received & registration cannot be
> completed so self validating without any effort.

3) You're building a text display system (forum posts, text chat, etc,
etc) and want to have web links and email addresses automatically
become clickable

4) You ask a user to provide "contact information". If s/he provides
an email address, you automatically send emails; if a phone number,
you automatically send SMS/text messages; otherwise, you leave it up
to a human to contact the user.

Plenty of possibilities beyond those two. Don't assume there's nothing
else that can be done just because your imagination can't come up with
anything :)

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


[issue29051] Improve error reporting involving f-strings (PEP 498)

2017-12-19 Thread Eric V. Smith

Eric V. Smith  added the comment:

The example above (msg289501) has been fixed. I think it was in #30465.

It also fixes some of these other cases, but I haven't reviewed them all.

--

___
Python tracker 

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



Re: [Python-Dev] [RELEASE] Python 3.6.4 is now available

2017-12-19 Thread Hasan Diwan
Grats to all!

On 19 December 2017 at 00:42, Ned Deily  wrote:

> On behalf of the Python development community and the Python 3.6
> release team, I am happy to announce the availability of Python 3.6.4,
> the fourth maintenance release of Python 3.6.  Detailed information
> about the changes made in 3.6.4 can be found in the change log here:
>
> https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-4-final
>
> Please see "What’s New In Python 3.6" for more information about the
> new features in Python 3.6:
>
> https://docs.python.org/3.6/whatsnew/3.6.html
>
> You can download Python 3.6.4 here:
>
> https://www.python.org/downloads/release/python-364/
>
> The next maintenance release of Python 3.6 is expected to follow in
> about 3 months, around the end of 2018-03.  More information about the
> 3.6 release schedule can be found here:
>
> https://www.python.org/dev/peps/pep-0494/
>
> Enjoy!
>
> --
>   Ned Deily
>   n...@python.org -- []
>
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> hasan.diwan%40gmail.com
>



-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
http://bit.ly/hd1ScheduleRequest.
Si vous voudrais faire connnaisance, allez a
http://bit.ly/hd1ScheduleRequest.

Sent
from my mobile device
Envoye de mon portable
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

The existing issue is #29051.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> Improve error reporting involving f-strings (PEP 498)

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Stefan Krah

Stefan Krah  added the comment:

Okay, I have never used something like that. Personally, I'd
disallow the global statement in g() if 'a' is local in f().

>>> a = 10
>>> def f():
... a = 20
... def g():
... global a
... print(a)
... g()
... 
>>> 
>>> f()
10

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Camion

Camion  added the comment:

My interrogation is about the fact that this doesn't seem to have been a 
collective decision and I'm not even sure it WAS anyone decision : it might as 
well have been an unintentional consequence of an implementation choice. 

So, in the "weakest" configuration, avoiding the implementation challenge for 
"design flaw" would require a language specification to at least mention that 
in this case, the behavior in undefined.

--

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

Yeah, I think you are correct.  Currently files not part of reference cycles 
get properly flushed and closed by the reference counter.  Implementing my 
"buffer_register_flush" patch would cause files to be closed only by the cyclic 
garbage collector (if not explicitly closed).  That would mean a script that 
opens a large number of files could run out of file descriptors.  Basically, we 
lose one of the main advantages of reference counting.

Probably the GC should keep track of how many files are open and call collect() 
when a threshold is reached.  Still, forcing every file to be collected only by 
the cyclic GC seems too ugly of a solution to this issue.

--

___
Python tracker 

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



[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread R. David Murray

R. David Murray  added the comment:

Hmm.  I suppose that could be clarified in the docs.  I would find it very 
counter-intuitive for the grandparent 'a' to be accessible, which is probably 
why I did not consider that an issue.

--

___
Python tracker 

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



Re: correctness proof for alpha-beta algorithm

2017-12-19 Thread namenobodywants
On Monday, December 18, 2017 at 10:16:07 PM UTC-8, Terry Reedy wrote:

> Where or how have you looked so far?  How formal do you want?

i want full-on formal with lots of rigor and every possible detail spelled out; 
i've looked in a couple of books but my best lead so far is a paper by knuth 
called "an analysis of alpha-beta pruning" - what i need is along those lines 
but with just a few more of the details spelled out

peace
stm

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


Re: What is wrong with this regex for matching emails?

2017-12-19 Thread alister via Python-list
On Mon, 18 Dec 2017 07:57:27 +1100, Ben Finney wrote:

> Peng Yu  writes:
> 
>> Hi,
>>
>> I would like to extract "a...@efg.hij.xyz". But it only shows ".hij".
> 
> Others have address this question. I'll answer a separate one:
> 
>> Does anybody see what is wrong with it? Thanks.
> 
> One thing that's wrong with it is that it is far too restrictive.
> 
>> email_regex =
>> re.compile('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)')
> 
> This excludes a great many email addresses that are valid. Please don't
> try to restrict a match for email addresses that will exclude actual
> email addresses.
> 
> For an authoritative guide to matching email addresses, see RFC 3696 §3
> .
> 
> A more correct match would boil down to:
> 
> * Match any printable Unicode characters (not just ASCII).
> 
> * Locate the *last* ‘@’ character. (An email address may contain more
>   than one ‘@’ character; you should allow any printable ASCII character
>   in the local part.)
> 
> * Match the domain part as the text after the last ‘@’ character. Match
>   the local part as anything before that character. Reject an address
>   that has either of these empty.
> 
> * Validate the domain by DNS request. Your program is not an authority
>   for what domains are valid; the only authority for that is the DNS.
> 
> * Don't validate the local part at all. Your program is not an authority
>   for what local parts are accepted to the destination host; the only
>   authority for that is the destination mail host.

At which point you have basicaly boiled your test down to 
@. which is rather pointless

there are only 2 reasons why you would want an email anyway

1) Data mining, just to add to your mailing list- in which case even if 
it validates you still don't know if it is a fake address to prevent spam 
so validating is pointless

2) it is part of a registration process, in which case if it is incorrect 
the registration email will not be received & registration cannot be 
completed so self validating without any effort.




-- 
OMNIVERSAL AWARENESS??  Oh, YEH!!  First you need four GALLONS of JELL-O
and a BIG WRENCH!! ... I think you drop th'WRENCH in the JELL-O as if
it was a FLAVOR, or an INGREDIENT ... ... or ... I ... um ... WHERE'S
the WASHING MACHINES?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32361] global / nonlocal interference : is this a bug, a feature or a design hole ?

2017-12-19 Thread Camion

Camion  added the comment:

David and Stefan, you're both missing my main point which is the fact that the 
presence of the global declaration in the parent (g) **blocks the access to the 
grand parent context**, which would be accessible without this global 
declaration (of another variable since that one is global. It just happen to 
have the same name) in g; and the stackoverflow post also ignores this question.

I do not disagree that this might be a desired feature (we might wish to reject 
this because of the potential confusion caused by this kind of name collision 
situation), but without any clear specification on it (since this point doesn't 
seem to have been discussed in the (or any?) PEP), it could always be 
challenged as a design flaw.

--

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You may switch to multiprocessing.Pool (with the "forkserver" method).

Otherwise, you could workaround it by executing a function on all workers that 
will reset the signal configuration. To maximize the chances that it does get 
executed on all workers, you could add a sleep() call inside it...

--

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Can you suggest an alternative to ProcessPoolExecutor for 3.6?

--

___
Python tracker 

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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Fixed in 3.7

--

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Benchmarks:

* before:

$ ./env-orig/bin/pyperf timeit "class Test: pass"
.
Mean +- std dev: 9.51 us +- 0.17 us

* after:

$ ./env/bin/pyperf timeit "class Test: pass"
.
Mean +- std dev: 8.89 us +- 0.09 us

--

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +inada.naoki, serhiy.storchaka, vstinner

___
Python tracker 

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



[issue32379] MRO computation could be faster

2017-12-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

MRO computation involves a complicated merge calculation over several lists.  
But, for the simple (common) case where a class has a single base, the 
computation could be much simpler: take the base's MRO and prepend the derived 
class.

--
components: Interpreter Core
messages: 308674
nosy: pitrou
priority: normal
severity: normal
status: open
title: MRO computation could be faster
type: performance
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



[issue29970] Severe open file leakage running asyncio SSL server

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset f7686c1f5553b24e3307506a18e18f6544de94d3 by Andrew Svetlov (Neil 
Aspinall) in branch 'master':
bpo-29970: Add timeout for SSL handshake in asyncio
https://github.com/python/cpython/commit/f7686c1f5553b24e3307506a18e18f6544de94d3


--
nosy: +asvetlov

___
Python tracker 

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



[issue30697] segfault in PyErr_NormalizeException() after memory exhaustion

2017-12-19 Thread Anthony Sottile

Anthony Sottile  added the comment:

Should this have landed in python3.6? It removes a public symbol 
`PyExc_RecursionErrorInst` (abi break?)

--
nosy: +Anthony Sottile

___
Python tracker 

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



Re: Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread MRAB

On 2017-12-19 18:33, Ziggy wrote:

I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/

The function called by .after should return to the tkinter's event loop. 
If you want to display a sequence of pictures, then the function should 
call .after to make it call the function again.


Here's a slightly reworked version:


import collections
import os

pictures = collections.deque()

for folder, subfolders, files in os.walk('/home/vimart/Python/img/'):
for file in files:
pictures.append(os.path.join(folder, file))

canvas_width = 300
canvas_height =300

master = Tk()

canvas = Canvas(master, width=canvas_width, height=canvas_height)
canvas.pack()

img = PhotoImage(file="sport.gif")
canvas.create_image(20,20, anchor=NW, image=img)

def change_img():
canvas.delete("all")
canvas.img = PhotoImage(file=pictures.popleft())
canvas.create_image(20,20, anchor=NW, image=canvas.img)

# If there's more to come, call again later.
if pictures:
master.after(3000, change_img)

master.after(3000, change_img)
mainloop()
--
https://mail.python.org/mailman/listinfo/python-list


[issue32378] test_npn_protocols broken with LibreSSL 2.6.1+

2017-12-19 Thread Christian Heimes

Change by Christian Heimes :


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

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset dc5770b161a5e28eeff73a406cd4eddb0676c5b5 by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.6':
bpo-32377: improve __del__ docs and fix mention about resurrection (GH-4927) 
(#4929)
https://github.com/python/cpython/commit/dc5770b161a5e28eeff73a406cd4eddb0676c5b5


--

___
Python tracker 

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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Ouch, yes, that's a tricky bug. This is definitely caused by the way that 
asyncio internally converts signals into messages along a pipe (well, socket, 
but same thing), and then after a fork-without-exec the child keeps writing 
into that pipe. It's exacerbated by asyncio's choice to use the self-pipe as 
its source of truth about which signals have arrived vs just a wake-up pipe 
(see [1]), but that's not really the main issue; even without this we'd get 
spurious wakeups and other unpleasantness.

In addition to the workarounds Antoine suggested, it would possibly make sense 
for forked children to disable any wakeup_fd, perhaps in PyOS_AfterFork or by 
adding a getpid() check to the C level signal handler. I can't think of any 
cases where you actually want to processes to share the same wake-up fd. And 
even if this isn't fixed at that level, it would make sense for asyncio to use 
the new atfork module to do something similar for asyncio specifically.

Also relevant: https://github.com/python/asyncio/issues/347

[1] https://github.com/dabeaz/curio/issues/118

--

___
Python tracker 

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



[issue32378] test_npn_protocols broken with LibreSSL 2.6.1+

2017-12-19 Thread Christian Heimes

New submission from Christian Heimes :

LibreSSL 2.6.1 to 2.6.4 have a broken implementation of NPN protocol. 2.6.0 and 
earlier are fine.


==
FAIL: test_npn_protocols (test.test_ssl.ThreadedTests)
--
Traceback (most recent call last):
  File "/home/heimes/dev/python/cpython/Lib/test/test_ssl.py", line 3424, in 
test_npn_protocols
self.assertEqual(client_result, expected, msg % (client_result, "client"))
AssertionError: None != 'http/1.1' : failed trying ['http/1.1', 'spdy/2'] (s) 
and ['http/1.1', 'spdy/2'] (c).
was expecting http/1.1, but got None from the client

Upstream issue https://github.com/libressl-portable/portable/issues/368

--
assignee: christian.heimes
components: SSL
messages: 308669
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: test_npn_protocols broken with LibreSSL 2.6.1+
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



Re: Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread Rhodri James

On 19/12/17 18:33, Ziggy wrote:

I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/


Nope.  Not following a link from someone I don't know (with all due 
respect) with a URL I don't immediately recognise.  If you want help, 
post your code here, preferably trimmed down to the minimum you need to 
demonstrate the problem.


--
Rhodri James *-* Kynesim Ltd
--
https://mail.python.org/mailman/listinfo/python-list


[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think it would be quite disruptive to create a reference cycle each time 
open() is called.  It may also break user scripts.

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 4b965930e8625f77cb0e821daf5cc40e85b45f84 by Antoine Pitrou in 
branch 'master':
bpo-32377: improve __del__ docs and fix mention about resurrection (#4927)
https://github.com/python/cpython/commit/4b965930e8625f77cb0e821daf5cc40e85b45f84


--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4823

___
Python tracker 

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



[issue17852] Built-in module _io can lose data from buffered files at exit

2017-12-19 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

Welp, another day another attempt.  As mentioned in the PR 4847, atexit is not 
the answer.  If the raw/buffered file pair are part of a reference cycle and 
the GC cleans it before atexit runs, then the buffered data can get lost.

I attempted to implement my weakref idea (i.e. raw file keeps a weakref to the 
buffered file, calls flush before the raw file gets closed).  That doesn't work 
either because the GC clears the weakref before calling __del__.

The attached patch "buffer_register_flush.txt" does seem to work.  The downside 
is that it creates a reference cycle between the raw and buffered file objects. 
 Perhaps that is not a problem since unless you call close() on the raw file, 
you will be leaking resources anyhow.  In the patch, calling close() removes 
the reference cycle.

I still feel like this is worth fixing, as ugly as the implementation is.

--
assignee:  -> nascheme
Added file: https://bugs.python.org/file47340/buffer_register_flush.txt

___
Python tracker 

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



Tkinter,show pictures from the list of files in catalog-problem

2017-12-19 Thread Ziggy
I have a problem with this code, it seems to work but first it shows
the picture then supposed to iterate through file list and shows them
each changed after 3seconds however show just the last one from list.
https://paste.pound-python.org/show/txvB4IBtlUrn3TuB0rtu/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I've proposed a documentation improvement in 
https://github.com/python/cpython/pull/4927 . Please chime in if you see have 
issues with it.

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
keywords: +patch
pull_requests: +4822
stage: needs patch -> patch review

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 19/12/2017 à 17:46, Eric Cousineau a écrit :
> 
> My current hack is to call `_PyGC_SET_FINALIZED(self, 0)` - may I ask if 
> there is a simpler way to do this?

Well... perhaps you could create another PyObject (it's just a wrapper,
right?) since the old one doesn't have any outside references to it
remaining.

Note that calling __del__ only once is also how PyPy works:
http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies

If there is some demand we could expose a higher-level spelling of
`_PyGC_SET_FINALIZED(self, 0)`.

--

___
Python tracker 

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



[issue31113] Stack overflow with large program

2017-12-19 Thread Stefan Nordhausen

Change by Stefan Nordhausen :


--
nosy: +snordhausen

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Agree, it's a bug.

+1 for getblocking()

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Eric Cousineau

Eric Cousineau  added the comment:

You're welcome, and thank you for the prompt response!

I will say that it feels a tad odd to only have `tp_finalize` be called once 
for the entire lifetime of the object, while still having the option of it 
being resurrected.
Is there any way to somehow "un-mark" the object to enable this workflow that I 
would like to have?

My current hack is to call `_PyGC_SET_FINALIZED(self, 0)` - may I ask if there 
is a simpler way to do this?

--

___
Python tracker 

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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the report.  Apparently I forgot to update that piece of 
documentation when PEP 442 was implemented.

--
nosy: +pitrou
stage:  -> needs patch
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



[issue32377] Difference in ressurrection behavior with __del__ in py2 vs. py3

2017-12-19 Thread Eric Cousineau

New submission from Eric Cousineau :

Due to how `PyObject_CallFinalizer` is written in python3, `__del__` will only 
*ever* be called once.

In my use case, I am experimenting with a feature in `pybind11` to prevent 
slicing with Python class instances that inherit from pybind11-C++ base 
classes, which involves detecting when an instance loses all reference in 
Python (`Py_REFCNT(...) == 0`) but still has reference in C++ 
(`shared_ptr::count() > 0`), and reviving the Python portion when this 
situation happens.

In python2, I could do this without a hitch, as a resurrected object could have 
its `__del__` method called multiple times (through `tp_dealloc` I believe?). 
But in python3, the object is marked with `_PyGC_SET_FINALIZED(...)`, thus 
preventing `__del__` from being called again.

It'd be nice to either (a) somehow allow `__del__` to be called naturally 
without too much fuss or, at the least, (b) have this reflected in the 
documentation:
https://docs.python.org/3/reference/datamodel.html#object.__del__

See attached `revive_test`. Example execution:

```
$ python2 ./revive_test.py 
Revive
Destroy
[ Done ]

$ python3 ./revive_test.py 
Revive
[ Done ]
```

--
assignee: docs@python
components: Documentation
files: revive_test.py
messages: 308660
nosy: Eric Cousineau, docs@python
priority: normal
severity: normal
status: open
title: Difference in ressurrection behavior with __del__ in py2 vs. py3
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: https://bugs.python.org/file47339/revive_test.py

___
Python tracker 

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



[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread Eric V. Smith

Eric V. Smith  added the comment:

Yes, this is a real problem. I think there's already an issue for this, but I 
can't find it.

Unfortunately, to fix it requires a bit of refactoring on how line numbers and 
errors are tracked. It's on my list of things to do.

--
nosy: +eric.smith
stage:  -> needs patch

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Now is having a timeout and blocking send/recv methods on a non-blocking 
> socket a feature? Or is this a bug?

I agree it's a bug (but should only be fixed in 3.7).

Also I agree with adding a socket.getblocking() method.

--

___
Python tracker 

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



[issue32376] Unusable syntax error reported when Python keyword in a f-string

2017-12-19 Thread Dmitry sky

New submission from Dmitry sky :

def get_search_url(from_, to):
return f"http://thesite.com/Search?SO0={from_}={to}={from}=false;
#   pls note `from_` vs `from`  ^^


$ python fstring.py
  File "", line 1
(from)
^
SyntaxError: invalid syntax


Should report real line #.

--
components: Interpreter Core
files: fstring.py
messages: 308657
nosy: Dmitry sky
priority: normal
severity: normal
status: open
title: Unusable syntax error reported when Python keyword in a f-string
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47338/fstring.py

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

It looks like we have a bug with 'sock.settimeout()' and non-blocking/blocking 
modes (or maybe this is a feature?)

Currently:

* to make a socket non-blocking, we call 'sock.settimeout(0)'.

* to make a socket blocking, we call 'sock.settimeout(None)'.


What happens if we call sock.settimeout(t), where t > 0?  The internal timeout 
field of the socket object will simply be set to 't'.  What happens if the 
socket was in a non-blocking mode?  Nothing, it stays in non-blocking mode.

What it means: suppose you have a non-blocking socket.  You call 
socket.settimeout(10), and most likely you wanted to make it blocking again.  
Because all operations on the socket become blocking from moment (sock_call_ex 
repeats on EWOULDBLOCK and EAGAIN).

Now is having a timeout and blocking send/recv methods on a non-blocking socket 
a feature? Or is this a bug?

--
nosy: +njs, pitrou

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Dustin Spicuzza

Dustin Spicuzza  added the comment:

I'm sure that the platform (a RT linux customized by National Instruments) has 
issues related to urandom, as this has reared it's ugly head with other PEP 525 
related issues also: https://bugs.python.org/issue29208

I'll have to try those suggestions to investigate the os.urandom issue.

--

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 19/12/2017 à 15:50, STINNER Victor a écrit :
> 
> Hum, it looks like an "embedded device", likely with no entropy source.

If it does I/O (which it probably does, being used for robotics), it
should certainly be able to extract entropy from the outside world.

If it doesn't, it's an OS implementation issue.

Of course it probably doesn't hurt to import concurrent.futures lazily.
However, people should generally not expect us to never call urandom()
when importing stdlib modules.

--

___
Python tracker 

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



[issue32375] Compilation warnings with gcc

2017-12-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

On Ubuntu 16.04:

$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ make
[...]
In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:797:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:806:9:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_argv0_path’ at ./Modules/getpath.c:683:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^
In function ‘wcsncpy’,
inlined from ‘calculate_argv0_path’ at ./Modules/getpath.c:736:13:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to 
‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with 
length bigger than size of destination buffer
  return __wcsncpy_chk_warn (__dest, __src, __n,
 ^

--
components: Interpreter Core
messages: 308653
nosy: pitrou, serhiy.storchaka, vstinner
priority: low
severity: normal
status: open
title: Compilation warnings with gcc
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



[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I get the feeling (without actually investigating) that this is because a 
fork()-created process inherits all the parent's configuration, including (in 
this case) signal handlers and whatever file descriptor was configured to 
receive signal events using signal.set_wakeup_fd().  So the child process, when 
it receives a signal, also writes on that file descriptor which happens to be 
the same  underlying self-pipe as in the parent.

In Python 3.6 it seems there isn't much you can't do against this (well, 
nothing obvious, in any case). In Python 3.7, you'll have two fixes available 
in ProcessPoolExecutor (*):

* either pass an initializer function that resets signal configuration to a 
sane default state
* or pass a "forkserver" multiprocessing context that will avoid inheritance 
issues in the process pool workers

(*) see docs at 
https://docs.python.org/3.7/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor

I would generally recommend using "forkserver" whenever possible, since it 
eliminates all those inheritance issues by design.

--
nosy: +njs, pitrou
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



Re: [OT] Python and Excel

2017-12-19 Thread Rustom Mody
On Tuesday, December 19, 2017 at 4:38:17 AM UTC+5:30, Les Cargill wrote:
> oliver wrote:
> > That would be amazing. I still have nightmares of when I had to create this
> > big options analysis VBA program in Excel 2007.
> > 
> 
> 
> Odd - I haven't found VBA itself to be all that horrible. Yeah, it's got 
> some serious weaknesses but it jut hasn't bit me badly, yet. Then again,
> it's not something I do a lot of.

In the era of Windows 95-98 I did some VBA — I quite liked the experience
Coming to libreoffice I find it boasts many languages which can program it
But Ive never managed to make any headway

Evidently documentation matters more than fancy language features [at least to 
me]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread STINNER Victor

STINNER Victor  added the comment:

> Found on Python 3.6 on a low-resource platform (NI RoboRIO), ...

Hum, it looks like an "embedded device", likely with no entropy source.

To check if os.urandom() will block, try to call the following function in your 
main script:

>>> import os; os.getrandom(1, flags=os.GRND_NONBLOCK)
b'\xd1'

os.urandom() blocks at system startup until the entropy pool is initialized 
with 128 bytes of entropy. Once it's initialized, os.urandom() will never block 
again.

You may also check the number of entropy bytes available to /dev/random (Python 
uses /dev/urandom which is different):

$ cat /proc/sys/kernel/random/entropy_avail 
3748

For a longer explanation, see the PEP 524.

--
nosy: +vstinner

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
type:  -> behavior

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

By the way, I think you forgot to answer my question on python-dev:

> can you get multi-interpreter support *without* PEP 489?  That is, using 
> single-phase initialization and PyModule_GetState().

The doc currently isn't very clear about this.

--
nosy: +pitrou

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +scoder

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue29877] compileall hangs when accessing urandom even if number of workers is 1

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

So calling urandom() hangs on your device because there's not enough entropy?  
What OS is this running?  Modern Linux, at least, should never block in 
urandom() (AFAIK).

--
nosy: +christian.heimes, pitrou
type: behavior -> resource usage
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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Marcel Plch

Change by Marcel Plch :


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

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Petr Viktorin

Petr Viktorin  added the comment:

Marcel, could you look into this?

--
nosy: +Dormouse759

___
Python tracker 

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



[issue32374] Document that m_traverse for multi-phase initialized modules can be called with m_state=NULL

2017-12-19 Thread Petr Viktorin

New submission from Petr Viktorin :

After the create phase of multiphase initialization, the per-module state is 
NULL and the module object is reachable by the garbage collector. Between the 
create and exec phases, Python code is run and garbage collection can be 
triggered.
So, any custom m_traverse/m_clear/m_free function must be prepared to handle 
m_state being NULL. This is currently not well documented.

It might be useful to insert a call m_traverse after the first phase, at least 
in --with-pydebug mode, so the potential error gets triggered early.

--
components: Extension Modules
messages: 308647
nosy: encukou
priority: normal
severity: normal
status: open
title: Document that m_traverse for multi-phase initialized modules can be 
called with m_state=NULL
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



[issue32306] Clarify map API in concurrent.futures

2017-12-19 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Hi David,

> what happens behind the scenes is that the call blocks until all results are 
> computed and only then starts yielding them.

The current implementation of the Executor.map() generator is:

def result_iterator():
try:
# reverse to keep finishing order
fs.reverse()
while fs:
# Careful not to keep a reference to the popped future
if timeout is None:
yield fs.pop().result()
else:
yield fs.pop().result(end_time - time.time())
finally:
for future in fs:
future.cancel()


So it seems to me that results are yielded as soon as they arrive (provided 
they arrive in the right order).

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, pitrou
type: enhancement -> behavior
versions: +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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Change by Yury Selivanov :


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

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +asvetlov, vstinner

___
Python tracker 

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



[issue32373] Add socket.getblocking() method

2017-12-19 Thread Yury Selivanov

New submission from Yury Selivanov :

Currently we have the following methods:

* socket.settimeout(t) -- can set the socket in blocking mode, when t==0.
* socket.setblocking(flag) -- sets in blocking or non-blocking mode.
* socket.gettimeout() -- returns 0 when socket is in non-blocking mode.

socket.gettimeout() is the only easy way of checking if the socket is 
non-blocking or blocking, but it's not intuitive to use it.  It's especially 
strange that we have a setblocking() method without a corresponding 
getblocking().

I propose to add a 'socket.getblocking() -> bool' method.

--
assignee: yselivanov
components: Library (Lib)
messages: 308645
nosy: yselivanov
priority: normal
severity: normal
status: open
title: Add socket.getblocking() method
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



  1   2   >