[issue31833] Compile fail on gentoo for MIPS CPU of loongson 2f

2017-10-20 Thread emtone

New submission from emtone :

Here is the error message:
building '_multiprocessing' extension
creating
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing
mips64el-unknown-linux-gnu-gcc -pthread -fPIC -fno-strict-aliasing -O2
-march=loongson2f -Wa,-mfix-loongson2f-nop -pipe -fwrapv -DNDEBUG
-IModules/_multiprocessing -I. -IInclude -I/usr/local/include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/mips64el-unknown-linux-gnu
-c 
/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/multiprocessing.c
-o
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/multiprocessing.o
mips64el-unknown-linux-gnu-gcc -pthread -fPIC -fno-strict-aliasing -O2
-march=loongson2f -Wa,-mfix-loongson2f-nop -pipe -fwrapv -DNDEBUG
-IModules/_multiprocessing -I. -IInclude -I/usr/local/include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/mips64el-unknown-linux-gnu
-c 
/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/socket_connection.c
-o
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/socket_connection.o
mips64el-unknown-linux-gnu-gcc -pthread -fPIC -fno-strict-aliasing -O2
-march=loongson2f -Wa,-mfix-loongson2f-nop -pipe -fwrapv -DNDEBUG
-IModules/_multiprocessing -I. -IInclude -I/usr/local/include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Include
-I/var/tmp/portage/dev-lang/python-2.7.12/work/mips64el-unknown-linux-gnu
-c 
/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/semaphore.c
-o
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/semaphore.o
mips64el-unknown-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,--as-needed
-L. -Wl,-O1 -Wl,--as-needed -L. -fno-strict-aliasing -O2
-march=loongson2f -Wa,-mfix-loongson2f-nop -pipe -fwrapv -DNDEBUG -I.
-IInclude
-I/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Include
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/multiprocessing.o
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/socket_connection.o
build/temp.linux-mips64-2.7/var/tmp/portage/dev-lang/python-2.7.12/work/Python-2.7.12/Modules/_multiprocessing/semaphore.o
-L. -lpython2.7 -o build/lib.linux-mips64-2.7/_multiprocessing.so ***
WARNING: importing extension "_multiprocessing" failed with : [Errno 89] Function not implemented

--
components: Extension Modules
messages: 304695
nosy: emtone
priority: normal
severity: normal
status: open
title: Compile fail on gentoo for MIPS CPU of loongson 2f
type: compile error
versions: Python 2.7

___
Python tracker 

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



Re: multiprocessing shows no benefit

2017-10-20 Thread Michele Simionato
There is a trick that I use when data transfer is the performance killer. Just 
save your big array first (for instance on and .hdf5 file) and send to the 
workers the indices to retrieve the portion of the array you are interested in 
instead of the actual subarray.

Anyway there are cases where multiprocessing will never help, since the 
operation is too fast with respect to the overhead involved in multiprocessing. 
In that case just give up and think about ways of changing the original problem.
-- 
https://mail.python.org/mailman/listinfo/python-list


grapheme cluster library

2017-10-20 Thread Rustom Mody
Is there a recommended library for manipulating grapheme clusters?

In particular, in devanagari
क् + ि = कि 
in (pseudo)unicode names
KA-letter + I-sign = KI-composite-letter

I would like to be able to handle KI as a letter rather than two code-points.
Can of course write an automaton to group but guessing that its already
available some place…
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Roel van der Goot

Roel van der Goot  added the comment:

Thank you!

--

___
Python tracker 

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



[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Zachary Ware

Zachary Ware  added the comment:

That's already provided, just do `return outputs` instead of `print(outputs)`, 
and `outputs = event_loop.run_until_complete(main())`.  See 
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop.run_until_complete

--

___
Python tracker 

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



[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Roel van der Goot

Roel van der Goot  added the comment:

I have been thinking about my previous comment a bit more. For consistency 
there should at least be an await somewhere to move back from async land to 
non-async land.

For example:

#!/usr/bin/env python3

import asyncio

async def main():
cmds = [['ssh', 'user@host', 'echo {}'.format(i)] for i in range(4)]
creations = [asyncio.create_subprocess_exec(*cmd, 
stdout=asyncio.subprocess.PIPE, 
stderr=asyncio.subprocess.PIPE)
for cmd in cmds]
processes = [await creation for creation in creations]
outputs = [await process.communicate() for process in processes]
print(outputs)

if __name__ == '__main__':
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete(main())

prints

[(b'0\n', b''), (b'1\n', b''), (b'2\n', b''), (b'3\n', b'')]

It would be nice if you could somehow return outputs from main() and process 
the results in a non-async function. There are no async concepts left in 
outputs after all. But I am not aware of a way you can do this in Python 
currently.

--

___
Python tracker 

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



Re: Efficient counting of results

2017-10-20 Thread Steven D'Aprano
On Fri, 20 Oct 2017 09:05:15 -0800, Israel Brewster wrote:

> On Oct 19, 2017, at 5:18 PM, Steve D'Aprano 
> wrote:
>> What t1 and t2 are, I have no idea. Your code there suggests that they
>> are fields in your data records, but the contents of the fields, who
>> knows?
> 
> t1 and t2 are *independent* timestamp fields. My apologies - I made the
> obviously false assumption that it was clear they were timestamps, or at
> least times based on the fact I was calculating "minutes late" based on
> them.

It wasn't clear to me whether they were timestamps, flags, or something 
else. For example, you said:

"if the date of the first record was today, t1 was on-time,
and t2 was 5 minutes late"

which suggested to me that the first record is a timestamp, and t1 and t2 
were possibly enums or flags:

(date=Date(2017, 10, 21), key=key, t1=ON_TIME, t2=FIVE_MINUTES_LATE)

or possibly:

(date=Date(2017, 10, 21), key=key, t1=True, t2=False)

for example.


[...]
> Easily: because the record contains two DIFFERENT times. Since you want
> more concrete, we're talking departure and arrival times here. Quite
> easy to depart on-time, but arrive late, or depart late but arrive
> on-time.

Ah, the penny drops!

If you had called them "arrival" and "departure" instead of "t1" and 
"t2", it would have been significantly less mysterious.

Sometimes a well-chosen variable name is worth a thousand words of 
explanation.


>> It also contradicts your statement that it is *date* and *key* that
>> determines which late bin to use.
> 
> I never made such a statement. I said they are used to determine "WHAT
> on-time IS for the record", not WHETHER the record is on-time or not,
> and certainly not which late bin to use. To put it a different way,
> those are the key to a lookup table that tells me what T1 and T2 are
> *supposed* to be in order for *each one* to be on time.

Ah, that makes sense now. Thank you for explaining.


[...]
>> Rather, it seems that date and key are irrelevant and can be ignored,
>> it is only t1 and t2 which determine which late bins to update.
> 
> Except that then we have no way to know what t1 and t2 *should* be.

Yes, that makes sense now. Your example of the driver runs really helped 
clarify what you are computing.


> You
> apparently made the assumption that t1 and t2 should always be some
> fixed value.

I tried to interpret your requirements as best I could from your 
description. Sorry that I failed so badly.



[...]
> Perhaps a better approach to explaining is to pose the question the
> report is trying to answer:

That would have been helpful.

[...]
> As Stefan Ram pointed out, there is nothing wrong with the solution I
> have: simply using if statements around the calculated lateness of t1
> and t2 to increment the appropriate counters. I was just thinking there
> might be tools to make the job easier/cleaner/more efficient. From the
> responses I have gotten, it would seem that that is likely not the case,
> so I'll just say "thank you all for your time", and let the matter rest.

No problem. Sorry I couldn't be more helpful and glad you have a working 
solution.



-- 
Steven D'Aprano
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31831] EmailMessage.add_attachment(filename="long or spécial") crashes or produces invalid output

2017-10-20 Thread R. David Murray

R. David Murray  added the comment:

Does the patch in gh-3488 fix this?  I think it should, or if it doesn't that's 
a bug in the PR patch.

--

___
Python tracker 

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



[issue20825] containment test for "ip_network in ip_network"

2017-10-20 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
pull_requests: +4035

___
Python tracker 

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



[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Roel van der Goot

Roel van der Goot  added the comment:

Zachary,

Thank you for your response. I had the impression that async comprehensions are 
a bridge between async functions and non-async functions. Is there a wat to use 
async (and asyncio) and then go back to regular python? Or am I just wishful 
thinking? :-)

For example, it would be nice to start multiple processes through 
asyncio.create_subprocess_exec (or _shell) await twice and then process all the 
output in "traditional" (i.e., non-async) Python.

Cheers :),
Cannedrag

--

___
Python tracker 

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



[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Zachary Ware

Zachary Ware  added the comment:

Your async listcomp must also be defined within a coroutine to turn `async` 
into a keyword in 3.6.  The following is far from best practice (don't do this, 
I don't know what I'm doing! :), but at least it compiles and shows that it 
works:

async def arange(n):
for i in range(n):
yield i

async def alistcomp():
return [i async for i in arange(10)]

try:
next(alistcomp().__await__())
except StopIteration as e:
value = e.value

print(value)

--
nosy: +zach.ware
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



[issue31832] Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3

2017-10-20 Thread Roel van der Goot

New submission from Roel van der Goot :

$ python3
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> async def arange(n):
... for i in range(n):
... yield i
... 
>>> [i async for i in arange(10)]
  File "", line 1
[i async for i in arange(10)]
   ^
SyntaxError: invalid syntax
>>>

--
components: asyncio
messages: 304688
nosy: cannedrag, yselivanov
priority: normal
severity: normal
status: open
title: Async list comprehension (PEP 530) causes SyntaxError in Python 3.6.3
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



[issue31811] async and await missing from keyword list in lexical analysis doc

2017-10-20 Thread Yury Selivanov

Yury Selivanov  added the comment:

Ah, you mean this list: 
https://docs.python.org/3/reference/lexical_analysis.html#keywords ?

Your original link was a bit hard to read as it shows rest markup and not the 
actual list of keywords.  So I missed it, sorry.

I'll reopen the issue, please feel free to submit a PR!

--
resolution: not a bug -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue31811] async and await missing from keyword list in lexical analysis doc

2017-10-20 Thread Colin Dunklau

Colin Dunklau  added the comment:

Hi Yury, perhaps I've misinterpreted PEP 492, and I can't claim to understand 
how the parser works and thus how the changes in 
https://github.com/python/cpython/pull/1669 affect things, but it seems to me 
that async and await are truly reserved words now, not just only reserved in 
certain contexts. If that's true, shouldn't they also appear in the list in the 
lexical analysis doc?

I'd appreciate any clarification you (or anyone else) can offer.

--

___
Python tracker 

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



[issue31831] EmailMessage.add_attachment(filename="long or spécial") crashes or produces invalid output

2017-10-20 Thread calimeroteknik

calimeroteknik  added the comment:

Erratum: the output generated by python 3.5 and 3.4 causes line wraps in the 
SMTP delivery chain, which cause exactly the same breakage as ulterior 
versions: the crucially needed indendation of one space ends up being absent.

--
versions: +Python 3.4, Python 3.5

___
Python tracker 

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



[issue31831] EmailMessage.add_attachment(filename="long or spécial") crashes or produces invalid output

2017-10-20 Thread calimeroteknik

New submission from calimeroteknik :

The following code excerpt demonstrates a crash:

import email.message
mail = email.message.EmailMessage()
mail.add_attachment(
   b"test",
   maintype = "text",
   subtype  = "plain",
   filename = "I thought I could put a few words in the filename but apparently 
it does not go so well.txt" 
)
print(mail)

Output on python 3.7.0a1: 
https://gist.github.com/altendky/33c235e8a693235acd0551affee0a4f6
Output on python 3.6.2: https://oremilac.tk/paste/python-rfc2231-oops.log


Additionally, a behavioral issue is demonstrated by replacing in the above:
filename = "What happens if we try French in here? touché!.txt"


Which results in the following output (headers):

Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*=utf-8''What%20happens%20if%20we%20try%20French%20in%20here%3F%20touch%C3%A9%21.txt
MIME-Version: 1.0


Instead of, for example, this correct output (by Mozilla Thunderbird here):

Content-Type: text/plain; charset=UTF-8;
 name="=?UTF-8?Q?What_happens_if_we_try_French_in_here=3f_touch=c3=a9!.txt?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0*=utf-8''%57%68%61%74%20%68%61%70%70%65%6E%73%20%69%66%20%77%65;
 filename*1*=%20%74%72%79%20%46%72%65%6E%63%68%20%69%6E%20%68%65%72%65%3F;
 filename*2*=%20%74%6F%75%63%68%C3%A9%21%2E%74%78%74


Issues to note here:
-the "filename" parameter is not indented, mail clients ignore it
-the "filename" parameter is not split according to RFC 2231

The relevant standard is exemplified in section 4.1 of 
https://tools.ietf.org/html/rfc2231#page-5


Python 3.4.6 and 3.5.4 simply do not wrap anything, which works with  but is 
not conformant to standards.


Solving all of the above would imply correctly splitting any header.
Function "set_param" in /usr/lib/python*/email/message.py looked like a place 
to look.

Unfortunately I do not understand what's going on there very well.


As yet an additional misbehaviour to note, try to repeat the above print 
statement twice.
The result is not identical, and the second time you get the following output:

Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: 
attachment;*=utf-8''What%20happens%20if%20we%20try%20French%20in%20here%3F%20touch%C3%A9%21.txt
MIME-Version: 1.0

It would appear that "filename" has disappeared.
The issue does not reveal itself with simple values for the 'filename' 
argument, e.g. "test.txt".


PS: The above output also illustrates this (way more minor) issue: 
https://bugs.python.org/issue25235

--
components: email
messages: 304684
nosy: barry, calimeroteknik, r.david.murray
priority: normal
severity: normal
status: open
title: EmailMessage.add_attachment(filename="long or spécial") crashes or 
produces invalid output
type: crash
versions: 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



[issue20825] containment test for "ip_network in ip_network"

2017-10-20 Thread Mark Ignacio

Mark Ignacio  added the comment:

Hey Michel,

Are you still interested in pushing this patch through? It's be awesome if this 
got committed.

--

___
Python tracker 

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



[issue20825] containment test for "ip_network in ip_network"

2017-10-20 Thread Mark Ignacio

Change by Mark Ignacio :


--
nosy: +Mark.Ignacio
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue31830] asyncio.create_subprocess_exec doesn't capture all stdout output

2017-10-20 Thread Roel van der Goot

Change by Roel van der Goot :


--
components: asyncio
files: show.py
nosy: cannedrag, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.create_subprocess_exec doesn't capture all stdout output
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47228/show.py

___
Python tracker 

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



[issue31756] subprocess.run should alias universal_newlines to text

2017-10-20 Thread Gregory P. Smith

Change by Gregory P. Smith :


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



[issue31761] Failures and crashes when running tests by import

2017-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Perhaps there are issues specific to IDLE, but we should first fix issues not 
related to IDLE in #31794.

--

___
Python tracker 

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



[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-20 Thread Brett Cannon

Brett Cannon  added the comment:

As always, thanks for the fix, Oren!

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



[issue31781] crashes when calling methods of an uninitialized zipimport.zipimporter object

2017-10-20 Thread Brett Cannon

Brett Cannon  added the comment:


New changeset db60a5bfa5d5f7a6f1538cc1fe76f0fda57b524e by Brett Cannon (Oren 
Milman) in branch 'master':
bpo-31781: Prevent crashes when calling methods of an uninitialized 
zipimport.zipimporter object (GH-3986)
https://github.com/python/cpython/commit/db60a5bfa5d5f7a6f1538cc1fe76f0fda57b524e


--
nosy: +brett.cannon

___
Python tracker 

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



[issue31761] Failures and crashes when running tests by import

2017-10-20 Thread STINNER Victor

STINNER Victor  added the comment:

Sorry, I didn't read you comment. I just saw IDLE, I missed that you wrote
that the bug is unrelated to IDLE. Ooops

--

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2017-10-20 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This looks to be a duplicate of https://bugs.python.org/issue28326

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> multiprocessing.Process depends on sys.stdout being open

___
Python tracker 

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



Re: Save non-pickleable variable?

2017-10-20 Thread Israel Brewster
On Oct 20, 2017, at 11:09 AM, Stefan Ram  wrote:
> 
> Israel Brewster  writes:
>> Given that, is there any way I can write out the "raw" binary
>> data to a file
> 
>  If you can call into the Java SE library, you can try
> 
> docs.oracle.com/javase/9/docs/api/java/io/ObjectOutputStream.html#writeObject-java.lang.Object-
> 
>  , e.g.:
> 
> public static void save
> ( final java.lang.String path, final java.lang.Object object )
> { try
>  { final java.io.FileOutputStream fileOutputStream
>= new java.io.FileOutputStream( path );
> 
>final java.io.ObjectOutputStream objectOutputStream
>= new java.io.ObjectOutputStream( fileOutputStream );
> 
>objectOutputStream.writeObject( object );
> 
>objectOutputStream.close(); }
> 
>  catch( final java.io.IOException iOException )
>  { /* application-specific code */ }}
> 
> 
>> , and read it back in later?
> 
>  There's a corresponding »readObject« method in
>  »java.io.ObjectInputStream«. E.g.,
> 
> public static java.lang.Object load( final java.lang.String path )
> {
>  java.io.FileInputStream fileInputStream = null;
> 
>  java.io.ObjectInputStream objectInputStream = null;
> 
>  java.lang.Object object = null;
> 
>  try
>  { fileInputStream = new java.io.FileInputStream( path );
> 
>objectInputStream = new java.io.ObjectInputStream
>( fileInputStream );
> 
>object = objectInputStream.readObject();
> 
>objectInputStream.close(); }
> 
>  catch( final java.io.IOException iOException )
>  { java.lang.System.out.println( iOException ); }
> 
>  catch
>  ( final java.lang.ClassNotFoundException classNotFoundException )
>  { java.lang.System.out.println( classNotFoundException ); }
> 
>  return object; }
> 
>  However, it is possible that not all objects can be
>  meaningfully saved and restored in that way.

Thanks for the information. In addition to what you suggested, it may be 
possible that the Java library itself has methods for saving this object - I 
seem to recall the methods for displaying the data having options to read from 
files (rather than from the Java object directly like I'm doing), and it 
wouldn't make sense to load from a file unless you could first create said file 
by some method. I'll investigate solutions java-side.

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---

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

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


[issue31812] Document PEP 545 (documentation translation) in What's New in Python 3.7

2017-10-20 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



Re: multiprocessing shows no benefit

2017-10-20 Thread Jason
Yes, it is a simplification and I am using numpy at lower layers. You correctly 
observe that it's a simple operation, but it's not a shift it's actually 
multidimensional vector algebra in numpy. So the - is more conceptual and takes 
the place of hundreds of subtractions. But the example dies demonstrate the 
complexity and how I can divide the problem up conceptually. 

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


[issue31814] subprocess_fork_exec more stable with vfork

2017-10-20 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
components: +Extension Modules -Interpreter Core
type: behavior -> enhancement

___
Python tracker 

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



[issue31814] subprocess_fork_exec more stable with vfork

2017-10-20 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Using new syscalls for _posixsubprocess.c would be a feature so it would be 
limited to 3.7+ if done at all.

My gut feeling is that the real bug is in *any* library code that uses 
pthread_atfork() in a non thread safe manner.  That code is fundamentally 
broken as it is placing a burden upon the entire application that it lives 
within that the application and no other libraries may use threads or if it 
does that it may not launch subprocesses.

That is unrealistic.  So I'd blame OpenBlas and OpenMP.

Supporting alternate system calls seems like it would just paper over the issue 
of improper use of pthread_atfork rather than address the fundamental problem.

--
versions:  -Python 2.7, Python 3.4, 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



[issue9842] Document ... used in recursive repr of containers

2017-10-20 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +4033
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



[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2017-10-20 Thread Josh Cullum

Josh Cullum  added the comment:

Hi Ned,

LD_LIBRARY_PATH has been set with the lib paths for both, like I said the
module itself builds, I’ll add the module build logs later but the module
try’s to get loaded before the tests which unfortunately gives the error
undefined symbol: Tcl_GetCharLength
On Fri, 20 Oct 2017 at 20:57, Ned Deily  wrote:

>
> Ned Deily  added the comment:
>
> You may need to set LD_LIBRARY_PATH env variable to point to your Tcl and
> Tk libraries or, better, add an rpath entry to LDFLAGS.
>
> --
> nosy: +ned.deily
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2017-10-20 Thread Ned Deily

Ned Deily  added the comment:

You may need to set LD_LIBRARY_PATH env variable to point to your Tcl and Tk 
libraries or, better, add an rpath entry to LDFLAGS.

--
nosy: +ned.deily

___
Python tracker 

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



[issue31203] socket.IP_PKTINFO is missing from python

2017-10-20 Thread Ned Deily

Change by Ned Deily :


--
nosy: +`
stage:  -> commit review
versions:  -Python 2.7, Python 3.3, Python 3.4, 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



[issue31761] Failures and crashes when running tests by import

2017-10-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Victor, why do you persist in the nearly irrelevant focus on IDLE?  As I 
reported above, failures and crashes happen ***without*** involving IDLE.  
Serhiy appears to report the same in #31794.

--
title: Failures and crashes when running tests by import in IDLE -> Failures 
and crashes when running tests by import

___
Python tracker 

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



[issue31794] Issues with test.autotest

2017-10-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

As I reported on #31761, the exact result of 'import test.autotest' depends on 
exactly how it is run and with what.  I suspect that OS might have an effect.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-20 Thread Ned Deily

Change by Ned Deily :


--
nosy: +ned.deily

___
Python tracker 

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



[issue31814] subprocess_fork_exec more stable with vfork

2017-10-20 Thread Ned Deily

Change by Ned Deily :


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



[issue31811] async and await missing from keyword list in lexical analysis doc

2017-10-20 Thread Yury Selivanov

Yury Selivanov  added the comment:

They are covered here: 
https://github.com/python/cpython/blob/4a2d00cb4525fcb3209f04531472ba6a359ed418/Doc/reference/compound_stmts.rst#coroutines

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



[issue31826] Misleading __version__ attribute of modules in standard library

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +barry, serhiy.storchaka
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



[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread Ethan Furman

Ethan Furman  added the comment:

We definitely need time with either DeprecationWarning or FutureWarning before 
removing/substituting a function.

--

___
Python tracker 

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



[issue31813] python -m ensurepip hangs

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
title: python -m enshure pip stucks -> python -m ensurepip hangs

___
Python tracker 

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



[issue31811] async and await missing from keyword list in lexical analysis doc

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +yselivanov

___
Python tracker 

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



[issue31807] unitest.mock: Using autospec=True conflicts with 'wraps'

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +michael.foord

___
Python tracker 

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



[issue31807] unitest.mock: Using autospec=True conflicts with 'wraps'

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +ezio.melotti, rbcollins

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
versions: +Python 2.7, Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +davin, pitrou, terry.reedy

___
Python tracker 

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



[issue31798] `site.abs__file__` fails for modules where `__file__` cannot be modified

2017-10-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

2.7 site module has

def abs__file__():
"""Set all module' __file__ attribute to an absolute path"""
for m in sys.modules.values():
if hasattr(m, '__loader__'):
continue   # don't mess with a PEP 302-supplied __file__
try:
m.__file__ = os.path.abspath(m.__file__)
except (AttributeError, OSError):
pass

This code assumes that if an object [not coded in python] has read-only 
attributes, so that the attempt to write would raise TypeError, then it do not 
have .__file__, so there will be an AttributeError, and there will not be a 
TypeError to catch.  This is true of CPython builtins.

>>> list.__file__
Traceback (most recent call last):
  File "", line 1, in 
list.__file__
AttributeError: type object 'list' has no attribute '__file__'

>>> list.__file__ = ''
Traceback (most recent call last):
  File "", line 1, in 
list.__file__ = ''
TypeError: can't set attributes of built-in/extension type 'list'

On the other hand, C-coded _tkinter has a re-writable .__file__. 
>>> import _tkinter
>>> _tkinter.__file__
'C:\\Programs\\Python27\\DLLs\\_tkinter.pyd'
>>> _tkinter.__file__ = ''

>From the minimal information given, it appears that clr defies this 
>expectation by having an unwritable .__file__ attribute.  Hence the TypeError 
>in abs_file.  Unless a read_only .__file__ is somewhere documented as 
>prohibited, the bug seems to be not including TypeError in the exception tuple.

In 3.x, abs__file__ became abs_paths.  It has the same line with the same 
problem.

For testing, perhaps an instance of this in sys.modules would work.

class UnsettableFile:
def __getattr__(self, name):
return __file__
def __setattr__(self, name, value):
raise TypeError()

--
stage: needs patch -> test needed
status:  -> open

___
Python tracker 

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



Re: Save non-pickleable variable?

2017-10-20 Thread MRAB

On 2017-10-20 18:19, Israel Brewster wrote:

tldr: I have an object that can't be picked. Is there any way to do a "raw" 
dump of the binary data to a file, and re-load it later?

Details: I am using a java (I know, I know - this is a python list. I'm not asking 
about the java - honest!) library (Jasper Reports) that I access from python using 
py4j (www.py4j.org ). At one point in my code I call a 
java function which, after churning on some data in a database, returns an object (a 
jasper report object populated with the final report data) that I can use (via 
another java call) to display the results in a variety of formats (HTML, PDF, XLS, 
etc). At the time I get the object back, I use it to display the results in HTML 
format for quick display, but the user may or may not also want to get a PDF copy in 
the near future.

Since it can take some time to generate this object, and also since the data 
may change between when I do the HTML display and when the user requests a PDF 
(if they do at all), I would like to save this object for potential future 
re-use. Because it might be large, and there is actually a fairly good chance 
the user won't need it again, I'd like to save it in a temp file (tat would be 
deleted when the user logs out) rather than in memory. Unfortunately, since 
this is an object created by and returned from a java function, not a native 
python object, it is not able to be pickled (as the suggestion typically is), 
at least to my knowledge.

Given that, is there any way I can write out the "raw" binary data to a file, 
and read it back in later? Or some other way to be able to save this object? It is 
theoretically possible that I could do it on the java side, i.e. the library may have 
some way of writing out the file, but obviously I wouldn't expect anyone here to know 
anything about that - I'm just asking about the python side :-)

As far as I can tell, what you're getting is a Python object that's a 
proxy to the actual Java object in the Java Virtual Machine. The Python 
side might be taking to the Java side via a socket or a pipe, and not 
know anything about, or have access to, the internals of the Java object.


In fact, you can't even be sure how a particular Python object is laid 
out in memory without reading the source code.

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


Re: Efficient counting of results

2017-10-20 Thread MRAB

On 2017-10-20 18:05, Israel Brewster wrote:[snip]

In a sense, in that it supports my initial approach.

As Stefan Ram pointed out, there is nothing wrong with the solution I have: simply using 
if statements around the calculated lateness of t1 and t2 to increment the appropriate 
counters. I was just thinking there might be tools to make the job easier/cleaner/more 
efficient. From the responses I have gotten, it would seem that that is likely not the 
case, so I'll just say "thank you all for your time", and let the matter rest.

It occurred to me that it might be more efficient to start with the 
year-to-date first.


The reasoning is that over time the number of old entries will increase, 
so if you see that a timestamp isn't in this period_of_time, then it's 
not in any smaller_period_of_time either, so you can short-circuit.


Compare doing these for an old entry:

Day first: this day? no; this week? no; this month? no; this year? no.

Year first: this year? no.
--
https://mail.python.org/mailman/listinfo/python-list


[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This will break a code that depends on the current behavior on non-Windows 
platforms. And this will contradict the expectation of non-Windows programmers. 
If change the behavior of clock() on non-Windows platforms, it should be done 
only after the period of emitting FutureWarning.

--

___
Python tracker 

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



[issue31829] Portability issues with pickle

2017-10-20 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

After reading numerous pickle-related issues on GitHab, I have found that the 
most common issue with pickle in Python 2 is using it with files opened with 
text mode.

with open(file_name, "w") as f:
pickle.dump(data, f)

Initially pickle was a text protocol. But since implementing more efficient 
binary opcodes it is a binary protocol. Even the default protocol 0 is not 
completely text-safe. If save and load data containing Unicode strings with 
"text" protocol 0 using different text/binary modes or using text mode on 
different platforms, you can get an error or incorrect data.

I propose to add more defensive checks for pickle.

1. When save a pickle with protocol 0 (default) to a file opened in text mode 
(default) emit a Py3k warning.

2. When save a pickle with binary protocols (must be specified explicitly) to a 
file opened in text mode raise a ValueError on Windows and Mac Classic 
(resulting data is likely corrupted) and emit a warning on Unix and Linux. What 
the type of of warnings is more appropriate? DeprecationWarning, 
DeprecationWarning in py3k mode, RuntimeWarning, or UnicodeWarning?

3. Escape \r and \x1a (end-of-file in MS DOS) when pickle Unicode strings with 
protocol 0.

4. Detect the most common errors (e.g. module name ending with \r when load on 
Linux a pickle saved with text mode on Windows) and raise more informative 
error message.

5. Emit a warning when load an Unicode string ending with \r. This is likely an 
error (if the pickle was saved with text mode on Windows), but  this can a 
correct data if the saved Unicode string actually did end with \r. This is the 
most dubious proposition. On one hand, it is better to warn than silently 
return an incorrect result. On other hand, the correct result shouldn't provoke 
a warning.

--
components: Library (Lib)
messages: 304667
nosy: alexandre.vassalotti, benjamin.peterson, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Portability issues with pickle
type: enhancement
versions: Python 2.7

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-10-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Patch is trivial two lines but needs review and merge from someone familiar 
with Sphinx stuff.

[Éric, https://docs.python.org/devguide/experts.html contains the invalid 
Eric.Araujo]

--
nosy: +ezio.melotti, merwok, terry.reedy, willingc

___
Python tracker 

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



Save non-pickleable variable?

2017-10-20 Thread Israel Brewster
tldr: I have an object that can't be picked. Is there any way to do a "raw" 
dump of the binary data to a file, and re-load it later?

Details: I am using a java (I know, I know - this is a python list. I'm not 
asking about the java - honest!) library (Jasper Reports) that I access from 
python using py4j (www.py4j.org ). At one point in my 
code I call a java function which, after churning on some data in a database, 
returns an object (a jasper report object populated with the final report data) 
that I can use (via another java call) to display the results in a variety of 
formats (HTML, PDF, XLS, etc). At the time I get the object back, I use it to 
display the results in HTML format for quick display, but the user may or may 
not also want to get a PDF copy in the near future. 

Since it can take some time to generate this object, and also since the data 
may change between when I do the HTML display and when the user requests a PDF 
(if they do at all), I would like to save this object for potential future 
re-use. Because it might be large, and there is actually a fairly good chance 
the user won't need it again, I'd like to save it in a temp file (tat would be 
deleted when the user logs out) rather than in memory. Unfortunately, since 
this is an object created by and returned from a java function, not a native 
python object, it is not able to be pickled (as the suggestion typically is), 
at least to my knowledge.

Given that, is there any way I can write out the "raw" binary data to a file, 
and read it back in later? Or some other way to be able to save this object? It 
is theoretically possible that I could do it on the java side, i.e. the library 
may have some way of writing out the file, but obviously I wouldn't expect 
anyone here to know anything about that - I'm just asking about the python side 
:-)

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---




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


[issue31790] double free or corruption (while using smem)

2017-10-20 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The error log is not present.  Try uploading again.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31783] Race condition in ThreadPoolExecutor when scheduling new jobs while the interpreter shuts down

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +bquinlan

___
Python tracker 

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



[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread STINNER Victor

STINNER Victor  added the comment:

I wrote the PR 4062 which removes time.clock() implementation: time.clock 
becomes an alias to time.perf_counter.

haypo@selma$ ./python
Python 3.7.0a2+ (heads/clock-dirty:16b6a3033e, Oct 20 2017, 18:55:58) 
>>> import time
>>> time.clock is time.perf_counter
True

--

___
Python tracker 

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



Re: Efficient counting of results

2017-10-20 Thread Israel Brewster
On Oct 19, 2017, at 5:18 PM, Steve D'Aprano  wrote:
> What t1 and t2 are, I have no idea. Your code there suggests that they are
> fields in your data records, but the contents of the fields, who knows?

t1 and t2 are *independent* timestamp fields. My apologies - I made the 
obviously false assumption that it was clear they were timestamps, or at least 
times based on the fact I was calculating "minutes late" based on them.

> 
> 
>> d10, w10, m10, y10, d25, w25, m25 AND y25
> 
> Try using descriptive variable names rather than these cryptic codes.

I did. In my original post I showed the table with names like "t1 1-5min". 
Granted, that's for illustration purposes, not actual code, but still, more 
descriptive. These codes were just to keep consistent with the alternative data 
format suggested :-)

> 
> I don't understand what is *actually* being computed here -- you say that t1
> is "on time" and t2 is "5 minutes late", but that's a contradiction: how can
> a single record be both on time and 5 minutes late?

Easily: because the record contains two DIFFERENT times. Since you want more 
concrete, we're talking departure and arrival times here. Quite easy to depart 
on-time, but arrive late, or depart late but arrive on-time.

> It also contradicts your statement that it is *date* and *key* that determines
> which late bin to use.

I never made such a statement. I said they are used to determine "WHAT on-time 
IS for the record", not WHETHER the record is on-time or not, and certainly not 
which late bin to use. To put it a different way, those are the key to a lookup 
table that tells me what T1 and T2 are *supposed* to be in order for *each one* 
to be on time.

So, for example, to completely make up some data (since it doesn't matter in 
the slightest), date could be 10/5/17 with a key of 42 (Let's say that is a 
driver ID to keep things concrete for you), and using those values tells me 
(via the lookup table) that on 10/5/17, 42 should have a T1 of 10:15 and a T2 
of 11:30. As we said, those would be departure and arrival times, so what we're 
saying is that on 10/5, driver #42 was *scheduled* to depart at 10:15 and 
arrive at their destination at 11:30. So if T1 was *actually* 10:14, and T2 
was, say 11:35, then I could say that T1 was on-time (actually, a minute early, 
but that doesn't matter), while T2 was 5 minutes late. Maybe traffic was 
horrible, or he had a flat. 

However, if the date changed to 9/1/17 (with the key still being 42), there 
could be a completely different schedule, with completely different "late" 
results, even if the *actual* values of t1 and t2 don't change. Maybe he was 
supposed to make the run early on that day, say 10:00-11:15, but forgot and 
left at the same time as he was used to, thereby making him 14 minutes late 
departing. and really late arriving, or something.

> Rather, it seems that date and key are irrelevant and
> can be ignored, it is only t1 and t2 which determine which late bins to
> update.

Except that then we have no way to know what t1 and t2 *should* be. You 
apparently made the assumption that t1 and t2 should always be some fixed 
value. In fact, what t1 and t2 should be varies based on date and key (see the 
driver example above, or Chris Angelico's pizza example also works well). For 
any given date, there are dozens of different keys with different expected 
values of t1 and t2 (in the pizza example Chris gave the key might be order 
number), and for any given key, the expected value of t1 and t2 could vary 
based on what date it is (say we restart order numbers from 1 each day to make 
it easy to know how many orders we've done that day, or, of course, same driver 
different day, depending on which example you prefer).

> 
> Another question: you're talking about *dates*, which implies a resolution of
> 1 day, but then you talk about records being "five minutes late" which
> implies a resolution of at least five minutes and probably one minute, if not
> seconds or milliseconds. Which is it? My guess is that you're probably
> talking about *timestamps* (datetimes) rather than *dates*.

As stated, the data has two timestamp fields T1 and T2. So yes, the resolution 
of the data is "one minute" (we ignore sub-minute timings). However (and this 
addresses your understanding below as well), I am trying to get data for the 
date, week-to-date, month-to-date, and year-to-date. So there is four different 
"date" resolution bins in addition to the "minute" resolution bins.

Perhaps a better approach to explaining is to pose the question the report is 
trying to answer:

For the given date, how many departures were on time? How many were 1-5 minutes 
late? 6-15 minutes late? What about this week: how many on-time, 1-5 minutes 
late, etc? What about this entire month (including the given date)? What about 
this year (again, including the given date and month)? How about arrivals - 
same questions. 

As you can hopefully see 

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4032
stage: resolved -> patch review

___
Python tracker 

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



[issue31782] Add a timeout to multiprocessing's Pool.join

2017-10-20 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +davin, pitrou
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-20 Thread Stefan Behnel

Stefan Behnel  added the comment:

Seems like this isn't trivial, so I created a new ticket for this. See issue 
31828.

--

___
Python tracker 

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



[issue31828] Support Py_tss_NEEDS_INIT outside of static initialisation

2017-10-20 Thread Stefan Behnel

New submission from Stefan Behnel :

Following up on issue 25658, it was found that the current definition of 
Py_tss_NEEDS_INIT restricts its use to initialisers in C and cannot be used for 
arbitrary assignments. It is currently declared as follows:

#define Py_tss_NEEDS_INIT   {0}

which results in a C compiler error for assignments like "x = 
Py_tss_NEEDS_INIT".

I proposed to change this to

#define Py_tss_NEEDS_INIT   ((Py_tss_t) {0})

in compliance with GCC and C99, but that fails to compile in MSVC and probably 
other old C++-ish compilers.

I'm not sure how to improve this declaration, but given that it's a public 
header file, restricting its applicability seems really unfortunate.

--
components: Extension Modules, Interpreter Core
messages: 304661
nosy: masamoto, ncoghlan, scoder
priority: normal
pull_requests: 4031
severity: normal
status: open
title: Support Py_tss_NEEDS_INIT outside of static initialisation
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



[issue16737] Different behaviours in script run directly and via runpy.run_module

2017-10-20 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

> All of the differences in semantics make total sense when you realize `-m 
> pkg` is really conceptually shorthand for `import pkg.__main__` (w/ the 
> appropriate __name__ flourishes).
> So instead of selling `-m` as a way to run a module/package as a script, I 
> say we change the message/documentation to say it does an import with 
> __name__ changed and make specifying a script as the weird 
> reading-a-file-directly thing.

I agree the explanation makes sense. But is that the design we want?

In my opinion, the most meaningful purpose of `-m` is its ability to run a 
module/package as a script. I've rarely seen it used as a convenience for 
executing a Python file, but I've seen it used extensively for providing entry 
to the canonical behavior for a library:

- pip: python -m pip
- pytest: python -m pytest
- setuptools: python -m easy_install
- virtualenv: python -m virtualenv

[rwt](https://pypi.org/project/rwt) takes advantage of this mechanism as the 
primary way to invoke a module (because scripts don't provide an API at the 
Python interpreter level):

$ rwt -q paver -- -m paver --version
Paver 1.2.4 

I began using this functionality extensively when on Windows using pylauncher, 
as it was the only reliable mechanism to invoke behavior with a desired Python 
interpreter:

PS> py -3.3 -m pip

If the semantics of -m are by design and need to be retained, it seems to me 
there's a strong argument for a new parameter, one which works much as -m, but 
which has the semantics of launching a script (as much as possible). Consider 
"python -r module" (for Run). Alternatively, Python could distribute a new 
runner executable whose purpose is specifically for running modules. Consider 
"pyrun module".

I don't think it will be sufficient to simply add a --nopath0 option, as that 
would impose that usage on the user... and `python -m modulename` is just at 
the limit of what syntax I think I can reasonably expect my users to bear for 
launching a script.

My preference would be to alter the semantics of `-m` with the explicit 
intention to align it with script launch behavior, or to provide a new concise 
mechanism for achieving this goal.

Thoughts?

--

___
Python tracker 

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



[issue31827] Remove os.stat_float_times()

2017-10-20 Thread STINNER Victor

STINNER Victor  added the comment:

Attached PR 4061 removes os.stat_float_times().

--
components: +Library (Lib)

___
Python tracker 

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



[issue31827] Remove os.stat_float_times()

2017-10-20 Thread STINNER Victor

Change by STINNER Victor :


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

___
Python tracker 

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



[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you for your report Sebastian.

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



[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 1e78ed6825701029aa45a68f9e62dd3bb8d4e928 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (GH-4058) (#4059)
https://github.com/python/cpython/commit/1e78ed6825701029aa45a68f9e62dd3bb8d4e928


--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-20 Thread Stefan Behnel

Stefan Behnel  added the comment:

It seems that there's a simpler way that uses a cast on the literal. I added a 
pull request. Looks simple enough to not merit its own ticket, I think.

--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-20 Thread Stefan Behnel

Change by Stefan Behnel :


--
pull_requests: +4029

___
Python tracker 

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



[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4028

___
Python tracker 

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



[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 56cb465cc93dcb35aaf7266ca3dbe2dcff1fac5f by Serhiy Storchaka in 
branch 'master':
bpo-31825: Fixed OverflowError in the 'unicode-escape' codec (#4058)
https://github.com/python/cpython/commit/56cb465cc93dcb35aaf7266ca3dbe2dcff1fac5f


--

___
Python tracker 

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



[issue31827] Remove os.stat_float_times()

2017-10-20 Thread STINNER Victor

New submission from STINNER Victor :

os.stat_float_times() was introduced in Python 2.3 to get file modification 
times with sub-second resolution. The default remains to get time as seconds 
(integer). See commit f607bdaa77475ec8c94614414dc2cecf8fd1ca0a.

The function was introduced to get a smooth transition to time as floating 
point number, to keep the backward compatibility with Python 2.2.

In Python 2.5, os.stat() returns time as float by default: commit 
fe33d0ba87f5468b50f939724b303969711f3be5.

Python 2.5 was released 11 years ago. I consider that people had enough time to 
migrate their code to float time :-)

I modified os.stat_float_times() to emit a DeprecationWarning in Python 3.1: 
commit 034d0aa2171688c40cee1a723ddcdb85bbce31e8 (bpo-14711).

--
messages: 304655
nosy: haypo
priority: normal
severity: normal
status: open
title: Remove os.stat_float_times()
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



[issue31826] Misleading __version__ attribute of modules in standard library

2017-10-20 Thread Jakub Mateusz Dzik

New submission from Jakub Mateusz Dzik :

Several modules of the standard library (at least `re` and `csv`) have 
`__version__` strings.

The string is the same for Python 2.7-3.6:

>>> import re, csv; print(re.__version__, csv.__version__)
2.2.1 1.0

while documentation indicates changes in the modules.

Semantic versioning (recommended by PEP 440) suggests that at least minor 
version should change in such case.

I suspect it to be a "code fossil" which may be removed according to PEP 396.

--
components: Library (Lib)
messages: 304654
nosy: abukaj
priority: normal
severity: normal
status: open
title: Misleading __version__ attribute of modules in standard library
type: behavior
versions: Python 2.7, Python 3.4, 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



[issue31814] subprocess_fork_exec more stable with vfork

2017-10-20 Thread Albert Zeyer

Albert Zeyer  added the comment:

Here is some more background for a case where this occurs:
https://stackoverflow.com/questions/46849566/multi-threaded-openblas-and-spawning-subprocesses

My proposal here would fix this.

--

___
Python tracker 

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



[issue31761] Failures and crashes when running tests by import in IDLE

2017-10-20 Thread STINNER Victor

Change by STINNER Victor :


--
title: Failures and crashes when running tests by import. -> Failures and 
crashes when running tests by import in IDLE

___
Python tracker 

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



Re: integer copy

2017-10-20 Thread Thomas Jollans
On 2017-10-20 13:17, bartc wrote:
> On 20/10/2017 10:09, Thomas Jollans wrote:
> 
>> Read the source if you want to know how this is done.
>> https://github.com/python/cpython/blob/master/Lib/copy.py#L111
> 
> Good, informative comment block at the top of the type that you don't
> see often. Usually they concern themselves with licensing or with
> apportioning credits.
> 
> Still, copying looks pretty complicated...
> 

It is usual for Python modules, especially in the stdlib, to start with
an informative docstring. But you're right, this one is more detailed
and informative than most.


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


PyScripter 3.0.0 released

2017-10-20 Thread pyscripter
PyScripter is a free and open-source Python Integrated Development
Environment (IDE) created with the ambition to become competitive in
functionality with commercial Windows-based IDEs available for other
languages.

Here are the new features:
* Python 3.5, 3.6 and 3.7 support
* New Style Engine (VCL Styles) with high quality choices
* Visual Style Preview and selection (View, Select Style)
*Visual Source highlighter theme selection (Editor Options, Select theme)
* German Translation added 

See:
Announcement with screenshot: https://pyscripter.blogspot.com/
Features: https://github.com/pyscripter/pyscripter/wiki/Features
Downloads: https://sourceforge.net/projects/pyscripter/files
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


Re: integer copy

2017-10-20 Thread bartc

On 20/10/2017 10:09, Thomas Jollans wrote:


Read the source if you want to know how this is done.
https://github.com/python/cpython/blob/master/Lib/copy.py#L111


Good, informative comment block at the top of the type that you don't 
see often. Usually they concern themselves with licensing or with 
apportioning credits.


Still, copying looks pretty complicated...

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


[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-20 Thread Nick Coghlan

Nick Coghlan  added the comment:

Stefan: I'd expect so, but that's best covered by a new RFE and an associated 
PR (I'm not sure what you mean from the text description, but I assume it will 
be obvious as C code)

--

___
Python tracker 

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



Re: Re: Problem with StreamReaderWriter on 3.6.3? SOLVED

2017-10-20 Thread Peter via Python-list

Thanks MRAB, your solution works a treat.

I'm replying to the list so others can know that this solution works. 
Note that sys.stderr.detach() is only available in >= 3.1, so one might 
need to do some version checking to get it to work properly in both 
versions. It also can mess up with the buffering and therefore the order 
of the output of stderr vs stdout.


Thanks again.

Peter


On 20/10/2017 10:19 AM, MRAB wrote:

On 2017-10-19 22:46, Peter via Python-list wrote:

I came across this code in Google cpplint.py, a Python script for
linting C++ code. I was getting funny results with Python 3.6.3, but it
worked fine under 2.7.13

I've tracked the problem to an issue with StreamReaderWriter; the
traceback and error never shows under 3. The _cause_ of the error is
clear (xrange not in Py3), but I need the raised exception to show.

I'm running Python 3.6.3 32bit on Windows 10. I also get the same
results on Python 3.5.2 on Ubuntu (under WSL)

I'm not super familiar with rebinding stderr with codecs, but I'm
guessing they are doing it because of some Unicode issue they may have
been having.

I have a workaround - drop the rebinding - but it seems like there might
be an error in StreamReaderWriter.
Do other people see the same behaviour?
Is there something I'm not seeing or understanding?
Would I raise it on issue tracker?

Peter

--

import sys
import codecs

sys.stderr = codecs.StreamReaderWriter(
      sys.stderr, codecs.getreader('utf8'), codecs.getwriter('utf8'),
'replace')

# This should work fine in Py 2, but raise an exception in Py3
# But instead Py3 "swallows" the exception and it is never seen
print(xrange(1, 10))

# Although this line doesn't show in Py 3 (as the script has silently
crashed)
print("This line doesn't show in Py 3")

--

StreamReaderWriter is being passed an encoder which returns bytes 
(UTF-8), but the output stream that is being passed, to which it will 
be writing those butes, i.e. the original sys.stderr, expects str.


I'd get the underlying byte stream of stderr using .detach():

sys.stderr = codecs.StreamReaderWriter(sys.stderr.detach(), 
codecs.getreader('utf8'), codecs.getwriter('utf8'), 'replace')





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


[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
components: +Interpreter Core, Unicode
nosy: +eric.smith, ezio.melotti, haypo, serhiy.storchaka
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



Re: integer copy

2017-10-20 Thread Thomas Jollans
On 2017-10-20 10:58, ast wrote:
> 
> "ast"  a écrit dans le message de
> news:59e9b419$0$3602$426a7...@news.free.fr...
> 
> Neither works for large integers which is
> even more disturbing
> 
> a = 6555443
> b = copy.copy(a)
> a is b
> 
> True


Why is this disturbing? As you said, it'd be completely pointless.

As to what's going on: copy.copy does not make any attempt to copy
immutable types. That's all there is to it.

Read the source if you want to know how this is done.
https://github.com/python/cpython/blob/master/Lib/copy.py#L111



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


[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-20 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4026

___
Python tracker 

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



[issue31825] bytes decode raises OverflowError desipte errors='ignore'

2017-10-20 Thread Sebastian Kacprzak

New submission from Sebastian Kacprzak :

In Python 3.5 and earlier (tested 3.5.3 and 2.7.13)
b'\\\xfa'.decode('unicode-escape', errors='ignore')
did return '\\ú'

but in Python 3.6 it raises 
OverflowError: decoding with 'unicode-escape' codec failed (OverflowError: 
character argument not in range(0x11))


Python 3.6.1 (default, Sep  7 2017, 16:36:03) 
[GCC 6.3.0 20170406] on linux

--
messages: 304651
nosy: nait
priority: normal
severity: normal
status: open
title: bytes decode raises OverflowError desipte errors='ignore'
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: integer copy

2017-10-20 Thread Stephen Tucker
ast,

For what it's worth,

After

a = 5
b = 5
afloat = float(a)
bfloat = float(b)

afloat is bfloat

returns False.

Stephen Tucker.


On Fri, Oct 20, 2017 at 9:58 AM, ast  wrote:

>
> "ast"  a écrit dans le message de
> news:59e9b419$0$3602$426a7...@news.free.fr...
>
> Neither works for large integers which is
> even more disturbing
>
> a = 6555443
>
> b = copy.copy(a)
> a is b
>
> True
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: integer copy

2017-10-20 Thread ast


"Thomas Nyberg"  a écrit dans le message de 
news:mailman.378.1508491267.12137.python-l...@python.org...

On 10/20/2017 10:30 AM, ast wrote:

I am aware that it is useless to copy an integer
(or any immutable type).

...

any comments ?



Why is this a problem for you?

Cheers,
Thomas


It is not. It was a test. 


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


[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-20 Thread Stefan Behnel

Stefan Behnel  added the comment:

Would it be possible to define Py_tss_NEEDS_INIT as a constant variable instead 
of a static initialiser? That would enable its use also for non-static 
initialisations.

--
nosy: +scoder

___
Python tracker 

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



Re: integer copy

2017-10-20 Thread Thomas Nyberg
On 10/20/2017 10:30 AM, ast wrote:
> I am aware that it is useless to copy an integer
> (or any immutable type).
> 
>   ...
> 
> any comments ?
> 
>
Why is this a problem for you?

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


Re: integer copy

2017-10-20 Thread Alain Ketterlin
"ast"  writes:

> "ast"  a écrit dans le message de
> news:59e9b419$0$3602$426a7...@news.free.fr...
>
> Neither works for large integers which is
> even more disturbing
>
> a = 6555443
> b = copy.copy(a)
> a is b
>
> True 

In copy.py:

| [...]
| def _copy_immutable(x):
| return x
| for t in (type(None), int, long, float, bool, str, tuple,
|   frozenset, type, xrange, types.ClassType,
|   types.BuiltinFunctionType, type(Ellipsis),
|   types.FunctionType, weakref.ref):
| d[t] = _copy_immutable
| [...]

and d[t] is what decides how to copy, via _copy_dispatch.

So none of the types listed above will be actually copied.

It should be documented more precisely. You should file a
documentation-improvement request.

Also, the doc says:

| This version does not copy types like module, class, function, method,
| nor stack trace, stack frame, nor file, socket, window, nor array, nor
| any similar types.

But who knows what "similar types" are...

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


[issue17799] settrace docs are wrong about "c_call" events

2017-10-20 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



Re: integer copy

2017-10-20 Thread ast


"ast"  a écrit dans le message de 
news:59e9b419$0$3602$426a7...@news.free.fr...

Neither works for large integers which is
even more disturbing

a = 6555443
b = copy.copy(a)
a is b

True 


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


[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-20 Thread STINNER Victor

STINNER Victor  added the comment:

> 3) Find a workaround (such as calling the APIs used by _scproxy in a clean 
> supprocess).

I dislike the idea of *always* spawning a child process, I prefer to leave it 
as it is, but add a recipe in the doc, or add a new helper function doing that.

Spawning a subprocess can have side effects as well, whereas the subprocess is 
only need if you call the function after forking which is not the most common 
pattern in Python.

--

___
Python tracker 

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



[issue31203] socket.IP_PKTINFO is missing from python

2017-10-20 Thread Quentin Dawans

Change by Quentin Dawans :


--
nosy: +qdawans

___
Python tracker 

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



integer copy

2017-10-20 Thread ast

Hello, I tried the following:

import copy

a = 5
b = copy.copy(a)

a is b
True

I was expecting False

I am aware that it is useless to copy an integer
(or any immutable type). 


I know that for small integers, there is always a
single integer object in memory, and that for larger
one's there may have many.

a = 7
b = 7
a is b
True

a = 56543
b = 56543
a is b
False

But it seems that Python forbids to have two different
small integer objects with same value even if you
request it with:

a = 5
b = copy.copy(a)

any comments ?


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


Re: efficient way to get a sufficient set of identifying attributes

2017-10-20 Thread Robin Becker

On 19/10/2017 17:50, Stefan Ram wrote:

Robin Becker  writes:

...
this sort of makes sense for single attributes, but ignores the possibility of
combining the attributes to make the checks more discerning.


   What I wrote also applies to compound attributes
   (sets of base attributes).

   When there are n base attributes, one can form 2^n-1
   compound attributes from them, or 2^n-1-n proper compound
   attributes. Therefore, a combinatoric explosion might impede
   the brute-force approach. A heuristics might start to
   explore combinations of keys with the best s/l ratio first
   and/or use preferences for certain fields set by a human.



all good


   In database design, the keys are usually chosen by a
   human database designer using world knowledge. It sounds
   as if you want to have the computer make such a choice
   using only the information in the table as knowledge.


I think I am tending towards the chosen by real world knowledge approach :(



   Your "identifying attributes" are called "super keys"
   in database science. You probably want minimal
   identifying attribute sets (without unneeded attributes),
   which are called "candidate keys".



thanks for this and the reference below.



   So, now you can find and read literature, such as:

Journal of Al-Nahrain University
Vol.13 (2), June, 2010, pp.247-255
Science
247
Automatic Discovery Of Candidate In The Relational
 Databases Keys By Using Attributes Sets Closure
Yasmeen F. Al-ward
Department of Computer Science, College of Science,
Al-Nahrain University.

   (The title was copied by me as found, the contents is
   in the web and makes more sense than the title.)




--
Robin Becker

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


Re: multiprocessing shows no benefit

2017-10-20 Thread Thomas Nyberg
Correct me if I'm wrong, but at a high level you appear to basically
just have a mapping of strings to values and you are then shifting all
of those values by a fixed constant (in this case, `z = 5`). Why are you
using a dict at all? It would be better to use something like a numpy
array or a series from pandas. E.g. something like this without
multiprocessing:

-
import pandas as pd
from timeit import default_timer as timer

s = pd.Series(
xrange(10),
index=[str(val) for val in xrange(10)])

z = 5
start = timer()
x = s - 5
duration = float(timer() -start)
print duration, len(x), len(x) / duration
-

Then if you wanted to multiprocess it, you could basically just split
the series into num_cpu pieces and then concatenate results afterwards.

Though I do agree with others here that the operation itself is so
simple that IPC might be a drag no matter what.

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


[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-20 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Calling get_proxies() in a subprocess would also work, although I'd then prefer 
to use a small daemon proces to avoid the startup cost of a new process for 
every call to _scproxy functions.

There is a conflict between two goals w.r.t. the macOS port:

1) Integrate nicely with the platform

2) Be like other unixy platforms

The former requires the use of Apple specific APIs, like those used in 
_scproxy, but those cause problems when using fork without calling exec.

The latter is technically an issue for all processing using threads on POSIX 
systems (see 
), AFAIK 
users get bitten by this more on macOS because Apple appears to use threading 
in their implementation (making processes multi-threaded without explicitly 
using threading in user code), and because Apple explicitly checks for the 
"fork without exec" case and crashes the child proces.

This can of course also be seen as a qualify of implementation issue on macOS, 
as in "Apple can't be bothered to do the work to support this use case" ;-/

Anyways: As Ned writes this is unlikely to change on Apple's side and we have 
to life with that.

There's three options going forward:

1) Remove _scproxy

I'm -1 on that because I'm in favour of having good platform integration, 
Python's URL fetching APIs should transparently use the system proxy config 
configuration.

2) Document this problem and move on

3) Find a workaround (such as calling the APIs used by _scproxy in a clean 
supprocess).

The 3th option is probably the most useful in the long run, but requires 
someone willing to do the work.  I'm in principle willing to do the work, but 
haven't had enough free time to work on CPython for quite a while now (which 
saddens me, but that's off topic).

--

___
Python tracker 

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



[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-20 Thread Tal Einat

Change by Tal Einat :


--
nosy: +taleinat

___
Python tracker 

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