[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-11-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

Starting to make some progress on an implementation, and it occurs to me that 
if this approach does work out, it should make Python level trace functions 
*much* faster.

Right now, the call to the Python function in call_trampoline is bracketed by 
PyFrame_FastToLocals() and PyFrame_LocalsToFast(), even if the trace function 
never accesses frame.f_locals.

By contrast, with the proposed design, PyFrame_LocalsToFast() never gets called 
anywhere (I've actually replaced the entire body with a PyErr_SetString call), 
and PyFrame_FastTo_Locals will only be called in the frame.f_locals descriptor 
implementation.

--

___
Python tracker 

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



Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw


no doubt tho after playing with this is that enumerate value ends up in the 
output which is a dictionary. The enumerate has no key which makes it invalid 
json if dumped.  

Not massive issue but getting the effect of enumerate without polluting output 
would be the winner.


>runner_lists = {} 
>for n, item in enumerate(result): 
># if this one is interested / not -filtered: 
>print(n, item) 
>runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"] 

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


Specialization for learning python from university of Michigan school of information

2017-11-04 Thread fatma . fars33
https://youtu.be/eblAxa5iO24. The video is just an introduction for a course on 
https://studyscienceblog.wordpress.com/2017/10/28/university-of-mitchigan-s-courses
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22257] PEP 432: Redesign the interpreter startup sequence

2017-11-04 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 1b46131ae423f43d45947bb48844cf82f6fd82b8 by Nick Coghlan in 
branch 'master':
bpo-22257: Mention startup refactoring in What's New (GH-4286)
https://github.com/python/cpython/commit/1b46131ae423f43d45947bb48844cf82f6fd82b8


--

___
Python tracker 

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



[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-11-04 Thread Nick Coghlan

Nick Coghlan  added the comment:


New changeset 1b46131ae423f43d45947bb48844cf82f6fd82b8 by Nick Coghlan in 
branch 'master':
bpo-22257: Mention startup refactoring in What's New (GH-4286)
https://github.com/python/cpython/commit/1b46131ae423f43d45947bb48844cf82f6fd82b8


--

___
Python tracker 

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



[issue22257] PEP 432: Redesign the interpreter startup sequence

2017-11-04 Thread Nick Coghlan

Change by Nick Coghlan :


--
pull_requests: +4248

___
Python tracker 

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



[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-11-04 Thread Nick Coghlan

Change by Nick Coghlan :


--
pull_requests: +4249

___
Python tracker 

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



[issue22257] PEP 432: Redesign the interpreter startup sequence

2017-11-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

Bug report (since resolved) that highlighted our general lack of test coverage 
for the interactions between environment variable based configuration and 
command line based configuration: https://bugs.python.org/issue31845

This work revealed the absence, since the refactoring changes the order in 
which we check environment variables and the command line (we used to check the 
command line first, and then env vars later during Py_Initialize, now we check 
env vars in _Py_InitializeCore, and the command line afterwards).

Something I'd also forgotten is that I'd switched the PEP to use 
"_Py_InitializeRuntime" and "_Py_ConfigureMainInterpreter", but the draft 
implementation is currently still using "_Py_InitializeCore" and 
"_Py_InitializeMainInterpreter".

For that last point, it's probably easier to change the PEP back than it is to 
tinker with the implementation - those specific API names are pretty arbitrary 
anyway.

--

___
Python tracker 

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



[issue31845] PYTHONDONTWRITEBYTECODE and PYTHONOPTIMIZE have no effect

2017-11-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

Cross-linking to the work-in-progress RFE that introduced the error: 
https://bugs.python.org/issue22257

--

___
Python tracker 

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



[issue25942] subprocess.call SIGKILLs too liberally

2017-11-04 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
versions: +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



[issue25942] subprocess.call SIGKILLs too liberally

2017-11-04 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



Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Steve D'Aprano
On Sat, 4 Nov 2017 04:44 am, Jon Ribbens wrote:

> On 2017-11-03, Steve D'Aprano  wrote:
>> The for loop does not necessarily perform a search:
>>
>> count = 1
>> for obj in sequence:
>> if count > MAX_OBJECTS:
>> print("too many objects, halting")
>> break
>> process(obj)
>> else:
>> print("finished")
>>
>> According to your mental model, this code is... what? Illegal? Silly?
>> Impossible? A syntax error?
> 
> That conforms to my model. It's searching for the condition
> 'count > MAX_OBJECTS'.

That's sounds to me that you are willing to call just about any test of a
condition inside a loop a "search". I don't think that's helpful. I think it
is mangling the word to the point it is meaningless.

How about a loop that exits at some random time? Is that a search?


for i in range(100, 0, -1):
if flip_coin() == 'Heads':
print("surprise!")
break
print("still running")
else:
print("countdown completed")


[...]
>> Your response to code that doesn't match your mental model is to say
>> that it is obviously wrong and probably buggy and should be made
>> into a syntax error if possible.
> 
> No, it isn't. Try reading again what I actually wrote.

What you actually wrote, in various posts:

You have a 'for...else' with no 'break'. Like I said, that should
probably be a syntax error.

if what the 'for' clause is doing doesn't match the concept 
of 'searching for a match' then it's obvious that you shouldn't
be using 'for...else' in the first place.

the language doesn't currently strictly enforce the requirement
for a 'break', but nevertheless if you don't have one you almost
certainly have a bug.


I stand by my comment as an accurate description of your response.


>> Ah yes, because it is inconceivable that anyone might have thought of a use
>> for for...else without a break.
> 
> It's not inconceivable, but nobody has thought of a sensible use so far
> (by which I mean one that shows it's a useful feature).

I find the code useful. I shouldn't have to justify why it is useful to me,
but for the record it especially comes in handy when I've already typed out a
multi-line loop in the REPL, and only then realised that I'll need some way
to add an extra line at the end. Since I spend a lot of time in the REPL
doing exploratory coding, this happens more often than I'd like.

Of course I could cancel the edit, then add in some sort of scaffolding code
to allow me to print an extra line at the end, then hit the up arrow
repeatedly to re-enter the lines I've already typed, editing them to fit the
scaffolding, then add the final print.

But that's tedious and painful and a waste of time and effort when it is
trivially easy to just add "else: print()". That is *simple* and it *works*
and it solves the problem.

And yes, a better REPL would also solve that problem. But I have to use the
REPL that exists, not the imaginary one that I'd like. If you want to call
this a hackish work around for a limitation of the REPL, I'll say... okay.
What's your point? It is still useful.

Try thinking outside the box. There's nothing wrong with finding unusual and
hackish uses for flow control statements.


[...]
>>> It's an incredibly obscure work-around for a different problem,
>>
>> You mean a different problem to "searching"? Yes indeed it is.
> 
> No, I mean a problem that has nothing to do with 'for...else' clauses.

I would say that it has nothing to do with the original motivation for
introducing for...else clauses into the language. Since it uses for...else,
it is pretty obtuse to deny that it has anything to do with for...else.

The for...else control statement is a tool. We can use tools for any purpose
we want, not just the ones that they were originally designed for. You are
declaring that a perfectly useful, albeit hackish, trick for the REPL is
illegitimate because it doesn't match your mental model.


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


Zen of Python “obvious way to do it” (was: [TSBOAPOOOWTDI]using names from modules)

2017-11-04 Thread Ben Finney
Steve D'Aprano  writes:

> On Sun, 5 Nov 2017 06:42 am, Stefan Ram wrote:
>
> > What is the one way to do it?
>
> There is no philosophy of "one way to do it" in Python, that is a
> misunderstanding (possibly deliberate...) spread about by Perl users,
> to contrast Python from Perl's "more than one way to do it".
>
> The Zen of Python says:
>
> There should be one-- and preferably only one --obvious way to do it.
>
>
> The emphasis is on "obvious", not "one". There should be *at least*
> one, but preferably only one, OBVIOUS way to solve any problem.

I think the confusion is quite understandable, and that the Zen was
written quite consciously referencing the (at the time quite well-known)
Perl princple “There's more than one way to do it”.

Of course, “consciously referencing and contrasting with some well-known
meme” is very close to “deliberately inviting confusion from those who
don't examine the contrast closely enough”.

So, I have given up trying to assign *blame* for that confusion. But
from what I can tell it's a canard to say that the confusion is “spread
about by Perl users”. On the contrary, in my experience, the confusion
is also spread quite well by non-Perl-using, Python advocates.

Heck, as someoone who works to *dispel* that confusion, I still find it
difficult to place the emphasis correctly when rattling off that
admonishment from the Zen.

-- 
 \“Perchance you who pronounce my sentence are in greater fear |
  `\   than I who receive it.” —Giordano Bruno, burned at the stake by |
_o__)  the Catholic church for the heresy of heliocentrism, 1600-02-16 |
Ben Finney

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


Re: Read Firefox sqlite files with Python

2017-11-04 Thread Steve D'Aprano
On Sun, 5 Nov 2017 04:32 am, Steve D'Aprano wrote:

> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
> 
> 
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')


Never mind. I dumped the file using the sqlite3 command line tool. Thank you
to all those who answered.

The file contains three INSERT statements, the first two don't have anything
of interest, and the third (which presumably contains all the data I'm trying
to recover) is an opaque 600+ KB blob.

Naturally. Why would you use a database as a database, when instead you could
just dump a big ball of mud into it?



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

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


Re: [TSBOAPOOOWTDI]using names from modules

2017-11-04 Thread Steve D'Aprano
On Sun, 5 Nov 2017 06:42 am, Stefan Ram wrote:

> What is the one way to do it?

There is no philosophy of "one way to do it" in Python, that is a
misunderstanding (possibly deliberate...) spread about by Perl users, to
contrast Python from Perl's "more than one way to do it".

The Zen of Python says:

There should be one-- and preferably only one --obvious way to do it.


The emphasis is on "obvious", not "one". There should be *at least* one, but
preferably only one, OBVIOUS way to solve any problem.

As for the question of importing names, the obvious way is to use a regular
import:


import math
y = math.cos(x)


which has the advantage of making it obvious where the name comes from, but
the disadvantage that it is more to type and involves an extra name lookup at
runtime, which is not free.

But:

- when performance matters

- or the name is very well known

- or you're only using a single name from the module (or at most a few)

- especially if it repeats the module name (e.g. fractions.Fraction)

it is acceptable to use the "from module import name" version:

from math import cos
y = cos(x)


Which you use depends on the situation and personal taste.



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

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


Re: python3 byte decode

2017-11-04 Thread Cameron Simpson

On 04Nov2017 01:47, Chris Angelico  wrote:

On Fri, Nov 3, 2017 at 8:24 PM, Ali Rıza KELEŞ  wrote:

Yesterday, while working with redis, i encountered a strange case.

I want to ask why is the following `True`

```
"s" is b"s".decode()
```

while the followings are `False`?

```
"so" is b"so".decode()
"som" is b"som".decode()
"some" is b"some".decode()
```

Or vice versa?

I read that `is` compares same objects, not values. So my question is
why "s" and b"s".decode() are same objects, while the others aren't?

My python version is 3.6.3.


You shouldn't be comparing string objects with 'is'. Sometimes two
equal strings will be identical, and sometimes they won't. All you're
seeing is that the interpreter happened to notice and/or cache this
particular lookup.


To be more clear here, usually when humans say "identical" they mean having 
exactly the same value or attributes. 

Here, Chris means that the two strings are actually the same object rather than 
two equivalent objects. "is" tests the former (the same object). "==" is for 
testing the latter (the objects have the same value).


For speed and memory reasons, Python notices small values of strings and ints, 
and allocates them only once. So When your write:


 a = "s"
 b = "s"

Python will reuse the same str object for both. Because of this, not only is "a 
== b" (i.e. they have the same value) but also "a is b" (a and b refer to the 
same object). But this is not guarrenteed, and certainly for larger values 
Python doesn't bother. Eg:


 a = "ghghghghghg"
 b = "ghghghghghg"

Here they will have the same value but be different objects. So "==" will still 
return True, but "is" would return False.


You should usually be using "==" to compare things. "is" has its place, but it 
is usually not what you're after.


In your example code, b"s".decode() returns the string value "s", and Python is 
internally deciding to reuse the existing "s" from the left half of your 
comparison. It can do this because strings are immutable. (For example, "+=" on 
a string makes a new string).


Hoping this is now more clear,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


Re: [TSBOAPOOOWTDI]using names from modules

2017-11-04 Thread Terry Reedy

On 11/4/2017 3:42 PM, Stefan Ram wrote:

   What is better:

...
import math
...
... math.cos ...
...

   or

...
from math import cos
...
... cos ...
...

   ?

   (To me, the first is more readable, because at the site
   where »math.cos« is used, it is made clear that »cos«
   comes from math. But I assume that the second might use
   one less name lookup and therefore is faster. What is the
   one way to do it?)


There is no 'one way', which is why there is more than one way.
The first lets the reader know the source at each use site.
The second lets the reader know what use is made of the source at the 
top.  The advantage depends on how familiar the *reader* is with the 
source module and the functions therein.


Is your question generic to any module and object,  or specific to the 
math module?  If generic, and mode is part of the package you are 
writing, then 'import mod' is less likely to create a circular import 
error.  On the other hand, 'from mod import obj' is better for testing 
because it lets one mock obj in the importing module without touching 
the imported module (where the original may be internally needed in the 
same test).  With idlelib, there are both circular import and testing 
issues.


If importing a module is expensive in some way, then knowing that B only 
needs one or two 'cheap' items from A is needed may suggest a workaround 
or refactoring.  For instance, move items from  A to B and reverse the 
import between them.


Replacing an existing 'from tkinter import *' with 'import tkinter' or 
'import tkinter as tk' requires prefixing every existing reference to a 
tkinter object.  Replacing the same with 'from tkinter import Tk, ...' 
requires list each object.  The latter localizes the patch.  Plus see 
the preceding paragraphs.  In either case, complete enough test coverage 
is needed to make the change.


I initially started with the 'as tk' replacement, but switched to the 
list version.  A tkinter-specific reason was planning to switch from tk 
to ttk versions of widgets.  Moving, for instance, 'Button' from the 
tkinter list to the tkinter.ttk list, instead of changing prefixes, 
would be both easy and make it obvious, at the top, that the change had 
been made, and for all Buttons.


--
Terry Jan Reedy


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


Re: Looping on a list in json

2017-11-04 Thread Cameron Simpson

On 04Nov2017 17:43, Sayth Renshaw  wrote:

figured it. Needed to use n to iterate when creating.


Yeah, my mistake.


runner_lists = {}
   for n, item in enumerate(result):
   # if this one is interested / not -filtered:
   print(n, item)
   runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"]


That's the beauty of offering untested code: I don't have to find and fix my 
errors:-)


Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
Sorry

figured it. Needed to use n to iterate when creating.

runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)
runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"]

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


Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw

> I'd just keep the interesting runners, along with their race numbers, in a 
> dict. The enumerate function is handy here. Something like (untested):
> 
>   runner_lists = {}
>   for n, item in enumerate(result):
> if this one is interested/not-filtered:
>   runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"]
> 
> and just return runner_lists. That way you know what the race numbers were 
> for 
> each list of runners.
> 

> 
> Cheers,
> Cameron Simpson 

The main issue is that enumerate doesn't enumerate on the lists when trying to 
filter.

result = meeting_id["Races"]

so yes enumerating this works, showing just printing n and item.

runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)

0 {'FeatureRaceBonusActive': 'Disabled', 'FixedPriceSummary': {'FixedPrices': 
[{'SportId': 8, 'LeagueId': 102, 'MeetingId': 1218, 'MainEventId': 650350, 
'SubEventId': 3601361, 'Status': 'F', 'StatusDescription': 'FINALISED', 
'BetTypeName': 'Win', 'EnablePlaceBetting': True}]}, 'RacingFormGuide': 
{'Copyright': .

and so on it goes through the 7 items in this file.

but including 

runner_lists = {}
for n, item in enumerate(result):
# if this one is interested / not -filtered:
print(n, item)
runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"]

## Produces

Traceback (most recent call last):
dict_keys(['RaceDay', 'ErrorInfo', 'Success'])
  File "/home/sayth/PycharmProjects/ubet_api_mongo/parse_json.py", line 31, in 

runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"]
TypeError: list indices must be integers or slices, not str


Cheers

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


Re: Aw: Try: Except: evaluates to True every time

2017-11-04 Thread Steve D'Aprano
On Sun, 5 Nov 2017 03:07 am, Karsten Hilbert wrote:

> Try in an interactive interpreter:
> 
>python> "a string" is True

Did you try that yourself?


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


[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Steve Dower

Change by Steve Dower :


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



[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:


New changeset f4443562345130c991fded3dc3b02b94aee0f362 by Steve Dower (Miss 
Islington (bot)) in branch '3.6':
bpo-31609: Fixes quotes in PCbuild/clean.bat (GH-4280) (#4285)
https://github.com/python/cpython/commit/f4443562345130c991fded3dc3b02b94aee0f362


--

___
Python tracker 

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



Re: Ideas about how software should behave

2017-11-04 Thread Ben Finney
Jon Ribbens  writes:

> On 2017-11-04, Ben Finney  wrote:
> > To respond to the criticism of an idea – criticism containing no
> > mention of the person – as though it “clearly refers to the
> > [person]”, is of significant concern on a software dicussion forum
> > such as this.
>
> No, the thing that is "of significant conern on a software discussion
> forum such as this" is people such as yourself defending the abuse of
> other contributors.

I have defended no such thing, because there was no such abuse of any
person in what you quoted.

Ideas are not people, and ideas do not automatically deserve respect
merely because some people hold those ideas.

-- 
 \  “Compulsory unification of opinion achieves only the unanimity |
  `\of the graveyard.” —Justice Roberts in 319 U.S. 624 (1943) |
_o__)  |
Ben Finney

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


[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Steve Dower

Change by Steve Dower :


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



Re: Read Firefox sqlite files with Python

2017-11-04 Thread Sayth Renshaw
On Sunday, 5 November 2017 04:32:26 UTC+11, Steve D'Aprano  wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
> 
> 
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')
> 
> 
> The error I get is:
> 
> Traceback (most recent call last):
>   File "", line 2, in 
>   File "/usr/local/lib/python3.5/sqlite3/dump.py", line 30, in _iterdump
> schema_res = cu.execute(q)
> sqlite3.DatabaseError: file is encrypted or is not a database
> 
> 
> If I open the file in a hex editor, it starts with:
> 
> SQLite format 3
> 
> and although I can see a few human readable words, the bulk of the file looks
> like noise.
> 
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

https://stackoverflow.com/a/18601429

Version mismatch between sqlite CLI and python sqlite API? I created again my 
db from the script instead of the CLI. Now insert and select work from the 
script, but not from the CLI. $sqlite -version returns 2.8.17, while the python 
version is 2.7.3.

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


Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
On Sunday, 5 November 2017 09:53:37 UTC+11, Cameron Simpson  wrote:

> >I want to get a result from a largish json api. One section of the json 
> >structure returns lists of data. I am wanting to get each resulting list 
> >returned.
> >
> >This is my code.
> >import json
> >from pprint import pprint
> >
> >with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') 
> >as f, open('socks3.json','w') as outfile:
> >to_read = json.load(f)
> [...]
> >meeting_id = to_read["RaceDay"]["Meetings"][0]
> >result = meeting_id["Races"]
> >#failing
> >for item in result:
> >pprint(["RacingFormGuide"]["Event"]["Runners"])
> 
> I'd just keep the interesting runners, along with their race numbers, in a 
> dict. The enumerate function is handy here. Something like (untested):
> 
>   runner_lists = {}
>   for n, item in enumerate(result):
> if this one is interested/not-filtered:
>   runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"]
> 
> and just return runner_lists. That way you know what the race numbers were 
> for 
> each list of runners.
> 
> >What is the best way to and return the data?
> 
> The basic idea is to make a small data structure of your own (just the 
> dictionary runner_lists in the example above) and fill it in with the 
> infomation you care about in a convenient and useful shape. Then just return 
> the data structure.
> 
> The actual data structure will depend on what you need to do with this later.
> 
> Cheers,


Thank you. That does seem a good approach. 

I was intending to merge other dictionary data from other dicts within the json 
structure and that's where the trouble starts i guess trying to get too much 
from json.

Thanks

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


[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:


New changeset 40708cc7d2361518a2784afedf495eafcc099de5 by Steve Dower (Miss 
Islington (bot)) in branch '3.6':
bpo-31944: Fixes build and Modify button (GH-4278) (#4284)
https://github.com/python/cpython/commit/40708cc7d2361518a2784afedf495eafcc099de5


--

___
Python tracker 

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



[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4247

___
Python tracker 

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



[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4246

___
Python tracker 

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



[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:


New changeset 0d2a9088d16826343344b04461c8be44b4008710 by Steve Dower in branch 
'master':
bpo-31944: Fixes build and Modify button (#4278)
https://github.com/python/cpython/commit/0d2a9088d16826343344b04461c8be44b4008710


--

___
Python tracker 

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



[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:


New changeset aed08562220974b5c67371b908f23caa1be07e38 by Steve Dower in branch 
'master':
bpo-31609: Fixes quotes in PCbuild/clean.bat (#4280)
https://github.com/python/cpython/commit/aed08562220974b5c67371b908f23caa1be07e38


--

___
Python tracker 

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



[issue25942] subprocess.call SIGKILLs too liberally

2017-11-04 Thread Stuart Berg

Change by Stuart Berg :


--
pull_requests: +4245

___
Python tracker 

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



[issue31932] setup.py cannot find vcversall.bat on MSWin 8.1 if installed in user AppData

2017-11-04 Thread Hugh Fisher

Hugh Fisher  added the comment:

The registry key is not totally reliable for finding the compiler.

What I did: my system is Windows 8.1 64 bit with Python 2.7 64 bit installed. 
I'd been testing a setup.py on Linux, time to try on MSWin. So I downloaded 
VCForPython27.msi as recommended by the Python docs, ran it, tried python 
setup.py build_ext. Failed because could not find VCVARSALL.BAT. Standard MSWin 
troubleshooting first step: restart. Still no.

Search turned up a freshly installed dir under AppData. After searching through 
distutils code, stepping through it, and poking around with RegEdit it turned 
out that while my system has various registry keys for Visual Studio versions 
from 7.1 through 12.0, even keys for 9.0, but not the particular one that 
find_vcvarsall wants.

Why not? How can I know? I added two lines of code to msvc9compiler.py and my 
extension now compiled.

To me, only the file system can be a totally reliable guide as to whether a 
particular path exists. I agree that it's not practical to wildly guess, or to 
search everywhere. But this is for Python 2.7, where the configuration has been 
frozen for all time. There's only a couple of places these files could be.

The additional code I've proposed will make Python continue to work even if the 
registry is clobbered. It will also make Python continue to work if the user 
copies the files from another system instead of running the installer. I think 
this is worthwhile, so ask that you reopen this issue.

--

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:

Thanks, Davy!

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 4376a2275967971a2f9586028347d6ed4ed6ef13 by Berker Peksag (Miss 
Islington (bot)) in branch '2.7':
bpo-31923: Fix spelling in sqlite3 docs (GH-4227)
https://github.com/python/cpython/commit/4376a2275967971a2f9586028347d6ed4ed6ef13


--

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 5c0100aec014b9e0a66884468cbfa3ac01e4bfbb by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-31923: Fix spelling in sqlite3 docs (GH-4227)
https://github.com/python/cpython/commit/5c0100aec014b9e0a66884468cbfa3ac01e4bfbb


--

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4244

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4243

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset aafece7a9e010075fff4420cfbb16f1ec0342698 by Berker Peksag (davy 
wybiral) in branch 'master':
bpo-31923: Fix spelling in sqlite3 docs (GH-4227)
https://github.com/python/cpython/commit/aafece7a9e010075fff4420cfbb16f1ec0342698


--
nosy: +berker.peksag

___
Python tracker 

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



[issue31923] Misspelled "loading" in Doc/includes/sqlite3/load_extension.py

2017-11-04 Thread Berker Peksag

Change by Berker Peksag :


--
type:  -> behavior
versions: +Python 2.7, Python 3.7

___
Python tracker 

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



[issue31946] mailbox.MH.add loses status info from other formats

2017-11-04 Thread Shai Berger

New submission from Shai Berger :

In mailbox.py in the stdlib, the functions MH.add and MH.__setitem__ take a 
message object and dump it to a file in the MH folder, which is good and well. 
However, they only call self._dump_sequences() if the message was already an 
MHMessage.

Since in the MH format, status details (whether the message was read, replied 
or flagged) are saved in these sequences, this effectively loses this 
information.

This means that, if "folder" is an MH folder and "message" is a message of any 
class other than MHMessage, 

   folder.add(message)

loses the information, while

   folder.add(MHMEssage(message))

retains it. This seems surprising and suboptimal.

--
components: Library (Lib), email
messages: 305572
nosy: barry, r.david.murray, shai
priority: normal
severity: normal
status: open
title: mailbox.MH.add loses status info from other formats
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: [TSBOAPOOOWTDI]using names from modules

2017-11-04 Thread Cameron Simpson

On 04Nov2017 20:59, Peter J. Holzer  wrote:

On 2017-11-04 19:42, Stefan Ram  wrote:

  What is better:
...
import math
...
... math.cos ...

  or
...
from math import cos
...
... cos ...
  ?

  (To me, the first is more readable, because at the site
  where »math.cos« is used, it is made clear that »cos«
  comes from math.


If I'm doing trigonometric computations I think the *second* is *much*
more readable. I'm using the well-known cosine function - that this was
imported from the math module is pure noise.

For other functions this may be less clear. I tend to use the first
style more often, although that gets a bit verbose sometimes
(os.path.join(os.path.dirname(...), ...)), [...]


I think the same. If the function is well known and idstinctively named, just 
use the short form ("cos(value)").


I also use the first style, but not often.

Regarding the less clear function names, particularly things like 
"os.path.join", my os.path imports often look like this these days:


 from os.path import dirname, exists as pathexists, isdir as pathisdir, join as 
joinpath

This lets me use distinct but short names in the code. To take Peter's example:

 joinpath(dirname(...), ...)

You can see I've given a distinctive name to "join", which would otherwise be 
pretty vague.


Cheers,
Cameron Simpson  (formerly c...@zip.com.au)"
--
https://mail.python.org/mailman/listinfo/python-list


Re: Looping on a list in json

2017-11-04 Thread Cameron Simpson

On 04Nov2017 14:01, Sayth Renshaw  wrote:
I want to get a result from a largish json api. One section of the json 
structure returns lists of data. I am wanting to get each resulting list 
returned.


This is my code.
import json
from pprint import pprint

with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') as 
f, open('socks3.json','w') as outfile:
   to_read = json.load(f)

[...]

   meeting_id = to_read["RaceDay"]["Meetings"][0]
   result = meeting_id["Races"]
   #failing
   for item in result:
   pprint(["RacingFormGuide"]["Event"]["Runners"])


I'd just keep the interesting runners, along with their race numbers, in a 
dict. The enumerate function is handy here. Something like (untested):


 runner_lists = {}
 for n, item in enumerate(result):
   if this one is interested/not-filtered:
 runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"]

and just return runner_lists. That way you know what the race numbers were for 
each list of runners.



What is the best way to and return the data?


The basic idea is to make a small data structure of your own (just the 
dictionary runner_lists in the example above) and fill it in with the 
infomation you care about in a convenient and useful shape. Then just return 
the data structure.


The actual data structure will depend on what you need to do with this later.

Cheers,
Cameron Simpson  (formerly c...@zip.com.au)
--
https://mail.python.org/mailman/listinfo/python-list


[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Steve Dower

Change by Steve Dower :


--
assignee:  -> steve.dower
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



[issue31609] PCbuild\clean.bat fails if the path contains whitespaces

2017-11-04 Thread Steve Dower

Change by Steve Dower :


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

___
Python tracker 

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



[issue31945] Configurable blocksize in HTTP(S)Connection

2017-11-04 Thread Nir Soffer

Change by Nir Soffer :


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

___
Python tracker 

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



[issue31945] Configurable blocksize in HTTP(S)Connection

2017-11-04 Thread Nir Soffer

New submission from Nir Soffer :

blocksize is hardcoded to 8192 in send() and _read_readable(), preventing
efficient upload when using file-like body.

Users of the module that are not interested in chunked encoding can rewrite
the copy loop using HTTPConnection.send():

   conn = HTTPSConnection(...)
   conn.putrequest(...)
   conn.putheader(...)
   conn.endheaders()

   while True:
   chunk = file.read(512*1024)
   if not chunk:
  break
   conn.send(chunk)

But fixing send() to use a configurable blocksize seems more useful.

Also, users of requests do not have access the underlying connection, so
they cannot use preferred buffer size.

When reading from /dev/zero and uploading to server that drop the received
data, larger buffer size gives 3X more throughput *and* 1/3 of cpu time.
With real storage and network, the effect will probably be much smaller.

--
components: Library (Lib)
messages: 305571
nosy: brett.cannon, haypo, nirs, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Configurable blocksize in HTTP(S)Connection
versions: Python 2.7, 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



[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Steve Dower

Change by Steve Dower :


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



[issue31944] Windows Apps and Features items only have "Uninstall"

2017-11-04 Thread Steve Dower

New submission from Steve Dower :

The installed item entries on Windows (since some recent update, I believe) 
only display "Uninstall" and do not let you select "Modify".

This is because we enabled the setting that used to display "Uninstall/Modify" 
as a single button. Clicking the Uninstall button (and confirming it) lets you 
modify or repair.

We should just enable both buttons so it isn't so scary to repair/modify an 
install.

--
assignee: steve.dower
components: Windows
messages: 305570
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Windows Apps and Features items only have "Uninstall"
type: behavior
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



[issue31937] Add the term "dunder" to the glossary

2017-11-04 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I would rather not clutter the glossary with this sort of entry.  Already, it 
has clutter that should probably be removed so that once again it becomes a 
worthwhile read rather than turning into a dictionary of random terms (such as 
meta-path-finder, module spec, and regular-package).

Instead, there should probably be a FAQ entry or wiki entry on the ever 
evolving spoken cultural terminology:

   dunder --> double underscore
   stir   --> __str__
   repper --> __repr__
   rest --> .rst files or representational-state-transfer
   sequel -> sql
   gwid -> globally unique indentifier
   inker and decker -> incref and decef(larry hastings pronunciation)

--
nosy: +rhettinger

___
Python tracker 

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



[issue31523] Windows build file fixes

2017-11-04 Thread Steve Dower

Change by Steve Dower :


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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:

And yes, I think this is fine for 3.6.

--

___
Python tracker 

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



[issue31932] setup.py cannot find vcversall.bat on MSWin 8.1 if installed in user AppData

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:

Duplicate of issue23246. AFAIK, nothing has changed since then.

The PR in its current form is not acceptable - there is a totally reliable 
registry key for finding the compiler, which is better than guessing a path. 
See the code in setuptools (and also make the case for why we should help 
people to build extensions without the fixes provided by setuptools, but do it 
on the existing issue).

--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> distutils fails to locate vcvarsall with Visual C++ Compiler 
for Python

___
Python tracker 

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



[issue31546] PyOS_InputHook is not called when waiting for input() in Windows

2017-11-04 Thread Steve Dower

Steve Dower  added the comment:

The fix is simple, just need someone to do a PR. (I might get to it eventually, 
but I'm working on other things right now.)

--

___
Python tracker 

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



[issue31415] Add -X option to show import time

2017-11-04 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

> with environment variable you get more information.

For timing package import time, such as for idlelib.pyshell, rather than bare 
python startup time, the extra information is just a bit more noise to ignore.

The importtime output is sent to stderr.  Should this be documented?  It is 
important because displaying results immediately on command prompt rather than 
redirecting to a file adds about .07 seconds to the total time reported for 
pyshell, whether I use debug or normal binaries.  The relative variation 
between repeated runs (about 1%) also seems less with redirection to a file.

--

___
Python tracker 

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



Looping on a list in json

2017-11-04 Thread Sayth Renshaw
Hi

I want to get a result from a largish json api. One section of the json 
structure returns lists of data. I am wanting to get each resulting list 
returned.

This is my code.
import json
from pprint import pprint

with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') as 
f, open('socks3.json','w') as outfile:
to_read = json.load(f)


print(to_read.keys())
# pprint(to_read)
meet = to_read["RaceDay"]["Meetings"]
meeting_id = to_read["RaceDay"]["Meetings"][0]
pprint(meeting_id.keys())
# result = meeting_id["Races"][1]["RacingFormGuide"]["Event"]["Runners"]
result = meeting_id["Races"]
#failing
for item in result:
pprint(["RacingFormGuide"]["Event"]["Runners"])


The key to the issue is that
result = meeting_id["Races"][0]["RacingFormGuide"]["Event"]["Runners"]
result = meeting_id["Races"][1]["RacingFormGuide"]["Event"]["Runners"]
result = meeting_id["Races"][2]["RacingFormGuide"]["Event"]["Runners"]

the numbers though in the above results could go from 0 to 10.

What is the best way to and return the data?
 would just save meeting_id["Races"] to my result however there are a lot of 
other junk dictionaries and lists I am filtering.

Cheers

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


[issue31942] Document that support of start and stop parameters in the Sequence's index() is optional

2017-11-04 Thread Nitish

Change by Nitish :


--
nosy: +nitishch

___
Python tracker 

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



Re: [TSBOAPOOOWTDI]using names from modules

2017-11-04 Thread Peter J. Holzer
On 2017-11-04 19:42, Stefan Ram  wrote:
>   What is better:
>
> ...
> import math
> ...
> ... math.cos ...
> ...
>
>   or
>
> ...
> from math import cos
> ...
> ... cos ...
> ...
>
>   ?
>
>   (To me, the first is more readable, because at the site
>   where »math.cos« is used, it is made clear that »cos«
>   comes from math.

If I'm doing trigonometric computations I think the *second* is *much*
more readable. I'm using the well-known cosine function - that this was
imported from the math module is pure noise.

For other functions this may be less clear. I tend to use the first
style more often, although that gets a bit verbose sometimes
(os.path.join(os.path.dirname(...), ...)), And I do notice that the
second style seems to be preferred in Django.

>   But I assume that the second might use
>   one less name lookup and therefore is faster. What is the
>   one way to do it?)

I'm not worried about performance unless there is clear performance
advantage (for real programs, not benchmarks).

hp

-- 
   _  | Peter J. Holzer| Fluch der elektronischen Textverarbeitung:
|_|_) || Man feilt solange an seinen Text um, bis
| |   | h...@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31942] Document that support of start and stop parameters in the Sequence's index() is optional

2017-11-04 Thread Nitish

Change by Nitish :


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



[issue31415] Add -X option to show import time

2017-11-04 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Okay, given the non-propagation and Windows issues.  I'm -1 on removing -X, +1 
on fixing the negative cache.

--

___
Python tracker 

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




Re: right list for SIGABRT python binary question ?

2017-11-04 Thread Karsten Hilbert
On Fri, Nov 03, 2017 at 07:31:56AM +0100, dieter wrote:

> > I have posted backtraces taken from the address being
> > watched. Does that help any at all ?
> 
> Only in the case that the error is "local", i.e. detected
> (quite) immediately.
> 
> You might be in this case as you have observed that the address
> is stable after library preload. Thus, it might not be a heap
> address but one associated with one of the libraries. Such
> a memory block should never be "freed". The backtrace would allow
> you to determine the library affected. Obtain its source. Recompile
> with symbols and try to find out where this memory block comes from.

Dieter, thanks for taking the time to explain the general
procedure. However, recompiling a library and trying to find
out where given block of memory comes from is way beyond
skills. I fear I have reached the end of what I can do.

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Try: Except: evaluates to True every time

2017-11-04 Thread Karsten Hilbert
On Sat, Nov 04, 2017 at 05:07:26PM +0100, Karsten Hilbert wrote:

> Try in an interactive interpreter:
> 
>python> "a string" is True

Or, rather,

python> if 'a string': print 'success'

Sorry,
Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31943] Add asyncio.Handle.cancelled() and asyncio.TimerHandle.when

2017-11-04 Thread Marat Sharafutdinov

New submission from Marat Sharafutdinov :

It would be handy to access the loop's time the Handle's callback will be 
called at if you are using delayed calls with "delay" (not "when") argument.
Also it is useful to know whether the call was cancelled through the special 
attribute.

--
assignee: docs@python
components: Documentation, Library (Lib), asyncio
messages: 305561
nosy: decaz, docs@python, yselivanov
priority: normal
pull_requests: 4238
severity: normal
status: open
title: Add asyncio.Handle.cancelled() and asyncio.TimerHandle.when
type: enhancement
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: Read Firefox sqlite files with Python

2017-11-04 Thread Peter Otten
Steve D'Aprano wrote:

> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
> 
> 
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line + '\n')
> 
> 
> The error I get is:
> 
> Traceback (most recent call last):
>   File "", line 2, in 
>   File "/usr/local/lib/python3.5/sqlite3/dump.py", line 30, in _iterdump
> schema_res = cu.execute(q)
> sqlite3.DatabaseError: file is encrypted or is not a database
> 
> 
> If I open the file in a hex editor, it starts with:
> 
> SQLite format 3
> 
> and although I can see a few human readable words, the bulk of the file
> looks like noise.

I've seen that error message before:

https://mail.python.org/pipermail/tutor/2013-July/097022.html

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


Aw: Try: Except: evaluates to True every time

2017-11-04 Thread Karsten Hilbert
Try in an interactive interpreter:

   python> "a string" is True

Karsten

> Gesendet: Samstag, 04. November 2017 um 16:31 Uhr
> Von: "brandon wallace" 
> An: python-list@python.org
> Betreff: Try: Except: evaluates to True every time
>
> 
> I have this code that tests a server to see if it is listening on port 123 
> runs and evaluates to True every time. Even if the server does not exist but 
> it is not supposed to do that. I am getting no error message at all. What is 
> going on with this code?
>  
>  
> 
> #!/usr/bin/env python
> 
> import socket
> 
> hostname = ["192.168.1.22", "192.168.1.23", "200.168.1.24", "19.0.0.0"]
> port = 123
> 
> def check_udp(hosts, port_num):
>     '''Test the UDP port on a remove server.'''
>     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>     for host in hosts:
>     try:
>     s.connect((host, port_num))
>     return "Port 53 is reachable on: %s" % host
>     except socket.error as e:
>     return "Error on connect: %s" % e
> 
> check_udp(hostname, port)
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31939] Support return annotation in signature for Argument Clinic

2017-11-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Currently nothing is supported Argument Clinic. Return converters don't contain 
information that can be used in return type annotation.

--

___
Python tracker 

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



[issue26467] Add async magic method support to unittest.mock.Mock

2017-11-04 Thread Chi Hsuan Yen

Change by Chi Hsuan Yen :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue31939] Support return annotation in signature for Argument Clinic

2017-11-04 Thread STINNER Victor

STINNER Victor  added the comment:

I am not asking for a full support of return type annotation. Just export
what is already supported in AC, export it in the signature.

--

___
Python tracker 

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



Read Firefox sqlite files with Python

2017-11-04 Thread Steve D'Aprano
I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.


import sqlite3
con = sqlite3.connect('foo.sqlite')
with open('dump.sql', 'w') as f:
for line in con.iterdump():
f.write(line + '\n')


The error I get is:

Traceback (most recent call last):
  File "", line 2, in 
  File "/usr/local/lib/python3.5/sqlite3/dump.py", line 30, in _iterdump
schema_res = cu.execute(q)
sqlite3.DatabaseError: file is encrypted or is not a database


If I open the file in a hex editor, it starts with:

SQLite format 3

and although I can see a few human readable words, the bulk of the file looks
like noise.




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

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


Re: Try: Except: evaluates to True every time

2017-11-04 Thread Steve D'Aprano
On Sun, 5 Nov 2017 02:31 am, brandon wallace wrote:

> 
> I have this code that tests a server to see if it is listening on port 123
> runs and evaluates to True every time. Even if the server does not exist but
> it is not supposed to do that. I am getting no error message at all. What is
> going on with this code?

You're returning a string in both cases. Both strings evaluate as true when
treated as bools.

Success:

> return "Port 53 is reachable on: %s" % host

Failure:

> except socket.error as e:
> return "Error on connect: %s" % e
> 
> check_udp(hostname, port)


That's the first bug. The second bug is that I don't think the code does what
you think it does. You seem to be calling it with a single hostname,
presumably a string. But then you split the hostname into individual letters,
and try to connect to each of them. The *first* attempt either succeeds or
fails, and then returns.

So if you call check_udp("mailserver", 143), your function calls

for host in "mailserver":
try:
s.connect((host, port_num))


which attempts to connect to ("m", 143). That will either succeed (probably
not), or fail (probably this), and then the function returns a string, which
you apparently never look at.

I suggest you re-write your check_udp function to something more like this:


def check_udp(host, port_num):
'''Test the UDP port on a remove server.'''
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect((host, port_num))
return True
except socket.error as e:
return False


But even this is suspicious, since it is vulnerable to a "Time Of Check To
Time Of Use" bug. Just because you can connect to the host *now*, when you
call check_udp, doesn't mean it will still respond two seconds later (or even
two milliseconds later) when you attempt to connect again.



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


Try: Except: evaluates to True every time

2017-11-04 Thread brandon wallace

I have this code that tests a server to see if it is listening on port 123 runs 
and evaluates to True every time. Even if the server does not exist but it is 
not supposed to do that. I am getting no error message at all. What is going on 
with this code?
 
 

#!/usr/bin/env python

import socket

hostname = ["192.168.1.22", "192.168.1.23", "200.168.1.24", "19.0.0.0"]
port = 123

def check_udp(hosts, port_num):
    '''Test the UDP port on a remove server.'''
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    for host in hosts:
    try:
    s.connect((host, port_num))
    return "Port 53 is reachable on: %s" % host
    except socket.error as e:
    return "Error on connect: %s" % e

check_udp(hostname, port)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Try: Except: evaluates to True every time

2017-11-04 Thread Chris Angelico
On Sun, Nov 5, 2017 at 2:31 AM, brandon wallace  wrote:
>
> I have this code that tests a server to see if it is listening on port 123 
> runs and evaluates to True every time. Even if the server does not exist but 
> it is not supposed to do that. I am getting no error message at all. What is 
> going on with this code?
>
>
>
> #!/usr/bin/env python
>
> import socket
>
> hostname = ["192.168.1.22", "192.168.1.23", "200.168.1.24", "19.0.0.0"]
> port = 123
>
> def check_udp(hosts, port_num):
> '''Test the UDP port on a remove server.'''
> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
> for host in hosts:
> try:
> s.connect((host, port_num))
> return "Port 53 is reachable on: %s" % host
> except socket.error as e:
> return "Error on connect: %s" % e
>
> check_udp(hostname, port)

Do you understand what it actually means to connect a UDP socket? If
not, I suggest reading up on the nature of UDP. You can't probe a
remote server this way; it simply doesn't work like that.

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


Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:22 PM, Jon Ribbens  wrote:
> On 2017-11-04, Michael Torrie  wrote:
>> On 11/03/2017 09:06 PM, Chris Angelico wrote:
>>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie  wrote:
 On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
> That's incorrect. There are multiple ways to exit a loop that
> will prevent the `else` block from executing, `break` is only one.

 Such as?
>>>
>>> There are many. But other than break, I don't know of any that WOULD
>>> execute the next line of code immediately _after_ the loop.
>>
>> Can you be more specific? What are some of these "many" ways of aborting
>> a loop?  Help a guy out here.
>>
>> I know, for example, that we have exceptions. But those hardly matter in
>> this discussion because they wouldn't execute the else clause either.
>> They'd either be caught elsewhere, or end the program.  sys.exit() can
>> also terminate a for loop, but it terminates the whole program without
>> running the else statement.
>
> Yes, those are the sort of thing that Steve was referring to.
> He was being unhelpfully pedantic. A giant meteor destroying
> the computer the program was running on would prevent the 'else'
> block from executing too.

My definition of "preventing else from executing" is that it would (a)
not execute code inside the else block, and (b) execute unindented
code immediately *after* that else block. Consider a try/finally
block:

try:
print("Setup")
...
finally:
print("Cleanup")
print("Carrying on")

Before we reach "carrying on", we are guaranteed to pass through
"cleanup". Steve's pedantry is 100% accurate for situations where the
setup and cleanup involve the network; you can't actually guarantee
that the cleanup will be performed (a hard exit will abort the whole
process, a 'kill -9' will shut you down, powering down the computer
means nothing happens), so you have to assume that the cleanup might
not happen (eg with PostgreSQL, the database server will roll back
your transaction and clean up the trash). But AFAIK there is no way to
reach "carrying on" without first executing "cleanup".

With the for-else clause, we have the same valid pedantry, but with a
few differences. A 'return' inside the loop will skip the 'else'
clause (but wouldn't skip a 'finally'), as will any exception. But
neither of those would hit "carrying on" either. AFAIK the only way to
skip the else *and hit the "carrying on" call* is to use 'break'.
That's a non-pedantic interpretation of "skip the else clause".

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


Re: matplot plot hangs

2017-11-04 Thread Andrew Z
Tim,
 it won't even advance to that line.

On Thu, Nov 2, 2017 at 8:28 AM, Tim Williams  wrote:

> On Wednesday, November 1, 2017 at 6:30:27 PM UTC-4, Andrew Z wrote:
> > nope. it doesnt:
> >
> > I added print-s after each line and that produced:
> > [az@hp src]$ cat ./main1.py
> > import matplotlib.pyplot as plt
> > print("imported")
> > plt.plot([1,2,4,1])
> > print("plot is done")
> > plt.show()
> > print("show is done")
> >
> > [az@hp src]$ python3.5 ./main1.py
> > imported
> > ^C^Z
> > [1]+  Stopped python3.5 ./main1.py
> >
> >
> > On Wed, Nov 1, 2017 at 9:31 AM, Vlastimil Brom  >
> > wrote:
> >
> > > 2017-11-01 13:49 GMT+01:00 Andrew Z :
> > > > Wolfgang,
> > > >  I tried to ran from ide with no rwsults, so now im trying from a
> > > terminal
> > > > in xwindow.
> > > > The .plot is the last line in the script and it does hang trying to
> > > execute
> > > > it.
> > > >
> > > >
> > > > On Nov 1, 2017 05:44, "Wolfgang Maier" <
> > > > wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> > > >
> > > > On 01.11.2017 00:40, Andrew Z wrote:
> > > >
> > > >> hello,
> > > >>   learning python's plotting by using matplotlib with python35 on
> > > fedora 24
> > > >> x86.
> > > >>
> > > >> Installed matplotlib into user's directory.
> > > >> tk, seemed to work -
> > > >> http://www.tkdocs.com/tutorial/install.html#installlinux - the
> window
> > > >> shows
> > > >> up just fine.
> > > >> but when trying to run the simple plot (
> > > >> https://matplotlib.org/examples/pylab_examples/simple_plot.html)
> the
> > > >> script
> > > >> is hanging on;
> > > >>
> > > >> plt.plot(t, s)
> > > >>
> > > >> attempts to
> > > >> matplotlib.interactive(True) didn't bring anything,
> > > >>
> > > >>
> > > > Hi Andrew,
> > > >
> > > > From which environment are you trying to run the example? In the
> > > terminal,
> > > > from within some IDE, inside a jupyter notebook?
> > > >
> > > > Are you sure the script "is hanging on plt.plot(t, s)" and not after
> > > that?
> > > >
> > > > Best,
> > > > Wolfgang
> > > >
> > > > --
> > > Hi,
> > > sorry if it is too trivial, just to make sure, do you have a call to
> > > "show()" the resulting plot in the code?
> > >
> > > An elementary plotting code might be e.g.:
> > >
> > > import matplotlib.pyplot as plt
> > > plt.plot([1,2,4,1])
> > > plt.show()
> > >
> > > Does this work in your environment?
> > >
> > > It was not quite clear, what do you plan with interactive drawing, or
> > > whether you are using e.g. plt.interactive(True) already - this might
> > > be a problem as there could be collisions or the plot window is closed
> > > after the standalone script finishes.
> > >
> > > hth,
> > >  vbr
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
>
> Have you tried
>
> plt.show(block=False)
> ?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31939] Support return annotation in signature for Argument Clinic

2017-11-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Argument Clinic doesn't have any relations to annotations. It is just by 
accident use the syntax similar to the syntax  of annotations in its 
declarations (and actually use Python parser for parsing them as anotations, 
but this is an implementation detail). It doesn't set argument annotations in 
signatures.

For example, chr() is declared with:

/*[clinic input]
chr as builtin_chr

i: int
/

Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10.
[clinic start generated code]*/

Argument Clinic generates:

PyDoc_STRVAR(builtin_chr__doc__,
"chr($module, i, /)\n"
"--\n"
"\n"
"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10.");

I think it could be possible to make Argument Clinic generating argument 
annotations basing on the accepted by converters types, but we are far from 
this.

--

___
Python tracker 

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



[issue31415] Add -X option to show import time

2017-11-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

(and Terry is right that environment variables can be significantly more 
annoying on Windows)

--

___
Python tracker 

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



[issue31415] Add -X option to show import time

2017-11-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

One benefit (or drawback, depending on how you see it) of the -X option is that 
it wouldn't propagate to child processes spawned by multiprocessing.  See 
_args_from_interpreter_flags() in Lib/subprocess.py.

More generally, the idea that we should remove a command line option because 
there's an environment variable sounds dubious to me.  Should we do the same 
for all command-line options?  The faulthandler module can be enabled either 
using the `PYTHONFAULTHANDLER` environment variable or by specifying `-X 
faulthandler` on the command line.

The only serious reason I can imagine would be that the -X option has a 
significant maintenance cost.

--
nosy: +pitrou

___
Python tracker 

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



[issue31939] Support return annotation in signature for Argument Clinic

2017-11-04 Thread Tal Einat

Tal Einat  added the comment:

I'm not sure that the current concept of return converters in AC is can be used 
for specifying return value annotations.

For example, what if I want to annotate the return value type with using a 
return converter?

Another example: The current doc-string for select.select() begins with:

select(rlist, wlist, xlist[, timeout]) -> (rlist, wlist, xlist)

I can't see how describing the return type being a 3-tuple of lists would work 
with return converters.

--
components: +Argument Clinic
nosy: +taleinat

___
Python tracker 

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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2017-11-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Chris Angelico
On Sat, Nov 4, 2017 at 11:25 PM, Jon Ribbens  wrote:
> On 2017-11-04, Ben Finney  wrote:
>> To respond to the criticism of an idea – criticism containing no mention
>> of the person – as though it “clearly refers to the [person]”, is of
>> significant concern on a software dicussion forum such as this.
>
> No, the thing that is "of significant conern on a software discussion
> forum such as this" is people such as yourself defending the abuse of
> other contributors.

Maybe we're not defending the abuse of other contributors. Maybe we're
defending a legitimate, if somewhat caustic, response to a ridiculous
suggestion.

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


[issue30806] netrc.__repr__() is broken for writing to file

2017-11-04 Thread Steven Loria

Change by Steven Loria :


--
pull_requests: +4237

___
Python tracker 

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



Re: Ideas about how software should behave (was: replacing `else` with `then` in `for` and `try`)

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Ben Finney  wrote:
> To respond to the criticism of an idea – criticism containing no mention
> of the person – as though it “clearly refers to the [person]”, is of
> significant concern on a software dicussion forum such as this.

No, the thing that is "of significant conern on a software discussion
forum such as this" is people such as yourself defending the abuse of
other contributors.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: replacing `else` with `then` in `for` and `try`

2017-11-04 Thread Jon Ribbens
On 2017-11-04, Michael Torrie  wrote:
> On 11/03/2017 09:06 PM, Chris Angelico wrote:
>> On Sat, Nov 4, 2017 at 1:57 PM, Michael Torrie  wrote:
>>> On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
 That's incorrect. There are multiple ways to exit a loop that
 will prevent the `else` block from executing, `break` is only one.
>>>
>>> Such as?
>> 
>> There are many. But other than break, I don't know of any that WOULD
>> execute the next line of code immediately _after_ the loop.
>
> Can you be more specific? What are some of these "many" ways of aborting
> a loop?  Help a guy out here.
>
> I know, for example, that we have exceptions. But those hardly matter in
> this discussion because they wouldn't execute the else clause either.
> They'd either be caught elsewhere, or end the program.  sys.exit() can
> also terminate a for loop, but it terminates the whole program without
> running the else statement.

Yes, those are the sort of thing that Steve was referring to.
He was being unhelpfully pedantic. A giant meteor destroying
the computer the program was running on would prevent the 'else'
block from executing too.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2017-11-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset d4d79bc1ff91b04625c312f0219c89aabcd19ce4 by Serhiy Storchaka in 
branch 'master':
bpo-28564: Use os.scandir() in shutil.rmtree(). (#4085)
https://github.com/python/cpython/commit/d4d79bc1ff91b04625c312f0219c89aabcd19ce4


--

___
Python tracker 

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



[issue31668] "fixFirefoxAnchorBug" function in doctools.js causes navigating problem in Py3 doc in Chrome

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:

This is indeed an annoying bug. Turns out there is already a compatibility shim 
for $.browser in doctools.js: 
https://github.com/sphinx-doc/sphinx/commit/c608af4babe140626877be08535af095ff633c00

I've opened https://github.com/sphinx-doc/sphinx/pull/4216 to add the 
"$.browser.firefox" check back.

There is nothing we can do here because we don't maintain a copy of doctools.js 
in Python codebase:

$ git ls-files | grep doctools.js

Thank you for your report.

--
nosy: +berker.peksag
resolution:  -> third party
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



[issue31678] Incorrect C Function name for timedelta

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:

Good catch, thank you!

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



[issue31678] Incorrect C Function name for timedelta

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset f9387469e82eccb6e0471037033f921be7f59909 by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-31678: Fix typo in PyDateTime_DELTA_GET_MICROSECONDS (GH-3869)
https://github.com/python/cpython/commit/f9387469e82eccb6e0471037033f921be7f59909


--

___
Python tracker 

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



[issue31678] Incorrect C Function name for timedelta

2017-11-04 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4236

___
Python tracker 

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



[issue31678] Incorrect C Function name for timedelta

2017-11-04 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 82cd3cede804ca694fb0657fd985d5eff84a414f by Berker Peksag 
(Phobosmir) in branch 'master':
bpo-31678: Fix typo in PyDateTime_DELTA_GET_MICROSECONDS (GH-3869)
https://github.com/python/cpython/commit/82cd3cede804ca694fb0657fd985d5eff84a414f


--
nosy: +berker.peksag

___
Python tracker 

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



[issue28340] [py2] TextIOWrapper.tell extremely slow

2017-11-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The original patch is quite delicate and I'm not comfortable backporting to 
2.7.  This is why it was pushed to 3.3 but not backported to 3.2.x (AFAIR).  
2.7 has existed with this issue for years, now, and is slowly nearing 
end-of-life.  I'll let Benjamin make the final decision.

--

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-04 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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 63ff4131af86e8a48cbedb9fbba95bd65ca90061 by Antoine Pitrou in 
branch 'master':
bpo-21423: Add an initializer argument to {Process,Thread}PoolExecutor (#4241)
https://github.com/python/cpython/commit/63ff4131af86e8a48cbedb9fbba95bd65ca90061


--

___
Python tracker 

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



[issue31604] unittest.TestLoader().loadTestsFromTestCase(...) fails when adding test cases with the expectedFailure decorator

2017-11-04 Thread Berker Peksag

Change by Berker Peksag :


--
nosy: +ezio.melotti, michael.foord, rbcollins

___
Python tracker 

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



[issue30406] async and await should be keywords in 3.7

2017-11-04 Thread Pierre Quentel

Pierre Quentel  added the comment:

According to PEP 492, async and await should have been deprecated in 3.5 and 
3.6, but I don't think they have been :

await = 1
def f(async=True):
...

don't raise any deprecation warning in 3.6.

Since version 3.7 will break existing code with a SyntaxError, could it be 
possible to have something explicit in the SyntaxError message for these new 
keywords, for instance

SyntaxError : 'async' is a keyword

I don't speack C so I can't provide a patch, sorry.

--
nosy: +quentel

___
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-11-04 Thread Berker Peksag

Change by Berker Peksag :


--
stage: needs patch -> backport needed

___
Python tracker 

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



[issue28197] Add start and stop parameters to the range.index() ABC method

2017-11-04 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Opened issue31942 for the documenting part.

--

___
Python tracker 

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



[issue31942] Document that support of start and stop parameters in the Sequence's index() is optional

2017-11-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +Devin Jeanpierre

___
Python tracker 

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



[issue28197] Add start and stop parameters to the range.index() ABC method

2017-11-04 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Interpreter Core -Documentation, Library (Lib)
keywords: +easy (C)
title: range.index mismatch with documentation -> Add start and stop parameters 
to the range.index() ABC method

___
Python tracker 

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



[issue31942] Document that support of start and stop parameters in the Sequence's index() is optional

2017-11-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Parameters start and stop were added to the Sequence.index() mixin method in 
3.5 (see issue23086). But not all concrete implementations of the Sequence ABC 
support them (for example range.index() doesn't, see issue28197). This should 
be explicitly documented (including the docstring of Sequence.index).

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 305547
nosy: docs@python, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Document that support of start and stop parameters in the Sequence's 
index() is optional
type: behavior
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



  1   2   >