[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread miss-islington


miss-islington  added the comment:


New changeset e53632019816749ffd5be0afab2a99d744dbbe35 by Miss Islington (bot) 
in branch '3.6':
bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258)
https://github.com/python/cpython/commit/e53632019816749ffd5be0afab2a99d744dbbe35


--

___
Python tracker 

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



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread miss-islington


miss-islington  added the comment:


New changeset e3f6aa7fe48b91f4ff619b2a51d473249d620bcb by Miss Islington (bot) 
in branch '3.7':
bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258)
https://github.com/python/cpython/commit/e3f6aa7fe48b91f4ff619b2a51d473249d620bcb


--
nosy: +miss-islington

___
Python tracker 

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



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8766

___
Python tracker 

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



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7843caeb909bd907e903606414e238db4082315a by Victor Stinner 
(Vladimir Matveev) in branch 'master':
bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258)
https://github.com/python/cpython/commit/7843caeb909bd907e903606414e238db4082315a


--
nosy: +vstinner

___
Python tracker 

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



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8765

___
Python tracker 

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



[issue34603] ctypes on Windows: error calling C function that returns a struct containing 3 bools

2018-09-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8764

___
Python tracker 

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



[issue34701] Asyncio documentation for recursive coroutines is lacking

2018-09-15 Thread Azaria Zornberg


Azaria Zornberg  added the comment:

Ah, thanks for the clarification!

I first encountered this when having some issues with converting large objects 
to json. json.dumps happens synchronously, and when executed on an object that 
was dozens of MB in size, it held up everything for a fair bit of time.
I tried to solve it by recursively running json.dumps on smaller pieces of the 
thing being converted to json. And that was when I realized that this still 
wasn't letting other things get scheduled.

When I looked for examples online, I didn't see any of a recursive asyncio 
coroutine, which is why I assumed the recursion was the issue.


Any advice on better ways to phrase the documentation are greatly appreciated! 
Alternatively, it sounds like you have a much better understanding of this than 
I do, so I'm happy to defer to whatever you believe is the correct way to 
document this. Thanks for the help!

--

___
Python tracker 

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



[issue34701] Asyncio documentation for recursive coroutines is lacking

2018-09-15 Thread Yury Selivanov


Yury Selivanov  added the comment:

The issue here is not the recursion,  but rather about the fact that coroutines 
should actually await on IO or other activity in order for the event loop to 
run them cooperatively.  E.g.

   async def foo():
await foo()

doesn't really do anything expect calling itself, whereas

   async def foo():
await sleep(0)
await foo()

is asking the event loop to sleep for a moment and then recurses into itself.

I'm OK with better clarifying this in the asyncio-dev.rst file.

--

___
Python tracker 

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



[issue34701] Asyncio documentation for recursive coroutines is lacking

2018-09-15 Thread Azaria Zornberg


Change by Azaria Zornberg :


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

___
Python tracker 

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



[issue34701] Asyncio documentation for recursive coroutines is lacking

2018-09-15 Thread Azaria Zornberg


New submission from Azaria Zornberg :

When an asynchronous coroutine in asyncio awaits or yields from itself, any 
call to the function is executed somewhat synchronously.

Once the recursive coroutine begins, if it never awaits any other coroutines 
besides itself, nothing else will be scheduled to run until it has completely 
finished recursively calling itself and returning.
However, if it ever awaits a different coroutine (even something as small as 
asyncio.sleep(0)) then other coroutines will be scheduled to run.

It seems, from other documentation, that this is intentional. Other 
documentation sort of dances around the specifics of how coroutines work with 
recursion, and only examples of coroutines yielding from each other recursively 
are provided.

However, this behavior is never explicitly called out. This is confusing for 
people who write a recursive asyncio coroutine and are perplexed by why it 
seems to execute synchronously, assuming they ever notice.

I've attached a short script that can be run to exhibit the behavior.
A PR is going to be filed shortly against the python 3.7 branch (as the 
documentation page for asyncio in 3.8 does not fully exist right now).

--
assignee: docs@python
components: Documentation, asyncio
files: asyncio_await_from_self_example.py
messages: 325468
nosy: asvetlov, azaria.zornberg, docs@python, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio documentation for recursive coroutines is lacking
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: https://bugs.python.org/file47805/asyncio_await_from_self_example.py

___
Python tracker 

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



[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Berker Peksag


Berker Peksag  added the comment:

Or we can special case functools.partial() in _copy_func_details() and use 
partial_object.func.__name__.

(I'm not sure which solution is better, but we need to the same thing for 
__doc__ as well.)

--

___
Python tracker 

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



[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Berker Peksag


Berker Peksag  added the comment:

I think option 2 is what functools.update_wrapper() does and it may be better 
to make create_autospec() consistent with it.

Perhaps we can replace _copy_func_details() with functools.update_wrapper():

assigments = (
'__name__', '__doc__', '__text_signature__',
# And the rest of the attributes in _copy_func_details().
)
functools.update_wrapper(..., assigned=assignments, updated=())

--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue32153] mock.create_autospec fails if an attribute is a partial function

2018-09-15 Thread Anthony Flury


Anthony Flury  added the comment:

It seems to me that we have three alternatives : 

  1. Refuse to create the mock object with a suitable Exception (rather than a 
crash
  2. Copy the object and simply ignore the missing dunder_name (so that funcopy 
dunder_name is not set
  3. Set funcopy dunder_name to a known string when the source dunder_name is 
missing

It seems obvious to me that option 3 is correct - just a question of what 
funcopy dunder_name should be set to. I would imagine there is code that uses 
funcopy dunder_name in some way ?

--
nosy: +anthony-flury

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2018-09-15 Thread Tim Peters


Tim Peters  added the comment:

New version of runstack.py.

- Reworked code to reflect that Python's sort uses (start_offset, run_length) 
pairs to record runs.

- Two unbounded-integer power implementations, one using a loop and the other 
division.  The loop version implies that, in Python's C implementation, size_t 
arithmetic would always suffice.  The division version shows that 2*d-1 bit 
unsigned division suffices if the # of array elements fits in d bits (so 64-bit 
ints in C would suffice for arrays up to 2**32 elements).

- Another power implementation using frexp - unpromising.

- And another that specializes the division method by rounding the array size 
up to a power of 2, removing the need for division.  Maybe worth looking at 
more, but offhand the results were significantly poorer.

- Added a "bad case" for powersort - surprising!  timsort and 2-merge are 
optimal in this case.  powersort "merge cost" is up to a third larger.

--
Added file: https://bugs.python.org/file47804/runstack.py

___
Python tracker 

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



[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-15 Thread Ammar Askar


Ammar Askar  added the comment:

Added a PR that is an implementation of Benjamin's suggestion. The column 
offset returned has been made 0-indexed and errors now point to the start of 
the parsed token.

This makes errors like `def class` show up as

def class
^

instead of

def class
^

Also added tests for the original example and some more errors from ast.c

--
nosy: +ammar2

___
Python tracker 

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



[issue34683] Caret positioned wrong for SyntaxError reported by ast.c

2018-09-15 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 

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



[issue31779] assertion failures and a crash when using an uninitialized struct.Struct object

2018-09-15 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

What are the drawbacks of moving all code from __init__ to __new__, at least in 
master branch (3.8)? IMO it's much more robust than playing whack-a-mole both 
with ref/memleaks caused by repeated calls to __init__ and absence of 
initialization checks in all methods.

--
nosy: +berker.peksag, izbyshev, mark.dickinson, meador.inge, serhiy.storchaka
versions: +Python 2.7, Python 3.6, Python 3.8

___
Python tracker 

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



[issue32117] Tuple unpacking in return and yield statements

2018-09-15 Thread Jordan Chapman


Jordan Chapman  added the comment:

Sorry, I could have sworn that I pasted my link... https://github.com/jChapman

--

___
Python tracker 

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



[issue32117] Tuple unpacking in return and yield statements

2018-09-15 Thread Jordan Chapman


Jordan Chapman  added the comment:

Here's my GitHub account: I'll make the changes and rebase as soon as I get 
home.

--

___
Python tracker 

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



[issue32117] Tuple unpacking in return and yield statements

2018-09-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

Jordan, what's your GitHub account name? I hope you can check this out and make 
the changes I'm requesting on GitHub.

--

___
Python tracker 

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



[issue34699] allow path-like objects in program arguments in Windows

2018-09-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks like a duplicate of issue31961.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
superseder:  -> subprocess._execute_child doesn't accept a single PathLike 
argument for args

___
Python tracker 

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



[issue33617] subprocess.Popen etc do not accept os.PathLike in passed sequence on Windows

2018-09-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks like a duplicate of issue31961.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
superseder:  -> subprocess._execute_child doesn't accept a single PathLike 
argument for args

___
Python tracker 

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



[issue34660] Replace ableist terms and pejoratives in source code.

2018-09-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am re-opening with the scope limited to source code that will not be part of 
a doc review.  The 2nd PR falls within this limit and I think it should be 
properly reviewed.

I am opposed to removing 'sanity check' as it has a well-enough defined meaning 
within programming that does not disparage the code author.  Indeed, sanity 
checks are often written and labelled as such by module authors.  PR9335 does 
not touch this phrase.

The other terms are more often applied to code by others, sometimes with a hint 
of disparagement of the author.

--
assignee: willingc -> 
nosy: +terry.reedy
resolution: remind -> 
stage: resolved -> patch review
status: closed -> open
title: Remove ableist terms and pejoratives from source code and docs -> 
Replace ableist terms and pejoratives in source code.

___
Python tracker 

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



[issue34699] allow path-like objects in program arguments in Windows

2018-09-15 Thread Guo Ci Teo


Change by Guo Ci Teo :


--
title: allows path-like objects in program arguments in Windows -> allow 
path-like objects in program arguments in Windows

___
Python tracker 

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



[issue34700] typing.get_type_hints doesn't know about typeshed

2018-09-15 Thread Ben Darnell


New submission from Ben Darnell :

Currently, most type annotations for the standard library are provided in 
typeshed rather than in the library itself. Not all consumers of type 
annotations are aware of typeshed, and this can cause problems. Specifically, 
Sphinx 1.8 accesses type hints via `typing.get_type_hints()`, which fails for 
some hints which are (implicitly) relying on typeshed. This currently manifests 
as failures to build Tornado's docs with Sphinx 1.8 (Tornado is using inline 
type annotations).

Concretely, the issue involves the `concurrent.futures.Future` class. In 
typeshed, this class is a `Generic[T]`, but in the standard library it's just a 
normal class. Consider a function that returns a parameterized Future type:

from concurrent.futures import Future

def do_something_background() -> 'Future[int]':
return executor.submit(do_something)

Note that the type annotation is already a string. We can't use `Future[int]` 
directly because at runtime, the real Future type is not subscriptable. The 
string defers resolution of the subscript until something tries to access the 
annotation *as a type hint*. When mypy does this, it uses the typeshed 
definition of Future, so everything passes. But when Sphinx calls 
`typing.get_type_hints()` on this function, it fails:

```
>>> typing.get_type_hints(do_something_background)
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py",
 line 1543, in get_type_hints
value = _eval_type(value, globalns, localns)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py",
 line 350, in _eval_type
return t._eval_type(globalns, localns)
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py",
 line 245, in _eval_type
eval(self.__forward_code__, globalns, localns),
  File "", line 1, in 
TypeError: 'type' object is not subscriptable
```


What can be done about this? I see a few approaches:

1. Require that any use of type hints consults typeshed. This would entail 
either making typing.get_type_hints aware of typeshed or deprecating and 
removing it.

2. Disallow references to typeshed from inline type annotations; types that 
require typeshed must only appear in `.pyi` stubs, which will only be 
interpreted by tools like mypy that know about typeshed. (is this true, or are 
there tools that know about pyi files but not typeshed?)

3. Annotate types in the standard library as generic. So far, this problem has 
always taken the form of "type is not subscriptable", and it could be resolved 
by making all generic types in the stdlib subclasses of `typing.Generic[T]`. 
This would bring enough typing detail into the stdlib to allow the annotations 
to be parsed without typeshed. This would also avoid the need for the awkward 
quotes in the example above.

--
messages: 325455
nosy: Ben.Darnell
priority: normal
severity: normal
status: open
title: typing.get_type_hints doesn't know about typeshed
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



[issue34685] scheduler tests for posix_spawn fail on AMD64 FreeBSD 10.x Shared 3.x

2018-09-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
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: Copy constructor and assignment operator

2018-09-15 Thread MRAB

On 2018-09-15 19:47, Ajay Patel wrote:


I have created below code and i want to restrict an object copy.
What are the methods called for copy constructor and assignment operator? 
Basically i don't want to allow below operation.

p = Point(1,3)
p2 = Point(6,7)

=> How to disallow below operations?
p(p2)
p = p2

Please point out a documentation for the same if available.


class Point:

 def _init_(self, x = 0, y = 0):
 self.x = x
 self.y = y

 def _str_(self):
 return "({0},{1})".format(self.x,self.y)

 def _repr_(self):
 return "({0},{1})".format(self.x,self.y)

 def _call_(self,other):
 print("_call_")
 self.x = other.x
 self.y = other.y

 def _setattr_(self, name, value):
 print("_setattr_",name,value)



"__init__", etc, are referred to as "dunder" methods because they have 
double leading and trailing underscores. Those that you wrote have only 
single leading and trailing underscores.


The term "copy constructor" is something from C++. It doesn't exist in 
Python.


Assignment statements _never_ copy an object. If you want a copy of an 
object, you have to be explicit.


Writing:

p = p2

will merely make 'p' refer to the same object that 'p2' currently refers to.

For making a copy of an object, have a look at the "copy" module.
--
https://mail.python.org/mailman/listinfo/python-list


[issue34699] allows path-like objects in program arguments in Windows

2018-09-15 Thread Guo Ci Teo


Change by Guo Ci Teo :


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

___
Python tracker 

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



[issue34699] allows path-like objects in program arguments in Windows

2018-09-15 Thread Guo Ci Teo


New submission from Guo Ci Teo :

Currently, the `subprocess.Popen` function allows for path-like objects in the 
argument list for POSIX but not in Windows.
This PR makes Windows' `subprocess.Popen` accept path-like objects in the 
argument list.

--
components: Library (Lib)
messages: 325454
nosy: guoci
priority: normal
severity: normal
status: open
title: allows path-like objects in program arguments in Windows
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34660] Remove ableist terms and pejoratives from source code and docs

2018-09-15 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +8759

___
Python tracker 

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



Re: Add header at top with email.message

2018-09-15 Thread Jason Friedman
>
> the EmailMessage class of email.message provides the methods
> add_header() and __setitem__() to add a header to a message.
> add_header() effectively calls __setitem__(), which does
> `self._headers.append(self.policy.header_store_parse(name, val))`.  This
> inserts the header at the bottom.
>
> It is, however, sometimes desired to insert a new header at the top of
> an (existing) message.  This API doesn’t directly allow this.  In my
> opinion, add_header() should have a flag at_top=False or similar, so
> that one can get this behaviour (it’ll be a bit difficult with
> __setitem__).  What do you think about this?  Is there a feasible way to
> do this and change the library?  Should I post it somewhere where the
> devs can hear it and suggest that?\
>

I see this in the docs at
https://docs.python.org/3/library/email.message.html#email.message.EmailMessage.get_unixfrom
:

The following methods implement the mapping-like interface for accessing
the message’s headers. Note that there are some semantic differences
between these methods and a normal mapping (i.e. dictionary) interface. For
example, in a dictionary there are no duplicate keys, but here there may be
duplicate message headers. Also, in dictionaries there is no guaranteed
order to the keys returned by keys(), but in an EmailMessage object,
headers are always returned in the order they appeared in the original
message, or in which they were added to the message later. Any header
deleted and then re-added is always appended to the end of the header list.

I suppose you already figured out that you can call __delitem__() to clear
the headers and add them back in whatever order you like.
I'm interested in learning more about your use case.  Do you have a third
party with fixed logic that requires the headers in a particular order?
-- 
https://mail.python.org/mailman/listinfo/python-list


Copy constructor and assignment operator

2018-09-15 Thread Ajay Patel


I have created below code and i want to restrict an object copy.
What are the methods called for copy constructor and assignment operator? 
Basically i don't want to allow below operation.

p = Point(1,3)
p2 = Point(6,7)

=> How to disallow below operations?
p(p2)  
p = p2

Please point out a documentation for the same if available.


class Point:

def _init_(self, x = 0, y = 0):
self.x = x
self.y = y

def _str_(self):
return "({0},{1})".format(self.x,self.y)

def _repr_(self):
return "({0},{1})".format(self.x,self.y)

def _call_(self,other):
print("_call_")
self.x = other.x
self.y = other.y

def _setattr_(self, name, value):
print("_setattr_",name,value)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33608] [subinterpreters] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2018-09-15 Thread Eric Snow


Change by Eric Snow :


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



[issue29883] asyncio: Windows Proactor Event Loop UDP Support

2018-09-15 Thread Adam Meily


Adam Meily  added the comment:

I've rebased onto upstream master and I fixed the CI build.

--

___
Python tracker 

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



[issue34515] lib2to3: support non-ASCII identifiers

2018-09-15 Thread miss-islington


miss-islington  added the comment:


New changeset 51dbae867e82014f9af89662977e4981463c51e8 by Miss Islington (bot) 
in branch '3.7':
closes bpo-34515: Support non-ASCII identifiers in lib2to3. (GH-8950)
https://github.com/python/cpython/commit/51dbae867e82014f9af89662977e4981463c51e8


--
nosy: +miss-islington

___
Python tracker 

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



Re: Experiences with a programming exercise

2018-09-15 Thread Alister via Python-list
On Sat, 15 Sep 2018 17:08:57 +, Stefan Ram wrote:

> I gave two different functions:
> 
> def triangle():
> for i in range( 3 ):
> forward( 99 ); left( 360/3 )
> 
> def rectangle()
> for i in range( 4 ):
> forward( 99 ); left( 360/4 )
> 
>   , and the exercise was to write a single definition for a function
>   »angle( n )« that can be called with »3« to paint a triangle and with
>   »4« to paint a rectangle. Nearly all participants wrote something like
>   this:
> 
> def angle( n ):
> if n == 3:
> for i in range( 3 ):
> forward( 99 ); left( 360/3 )
> if n == 4:
> for i in range( 4 ):
> forward( 99 ); left( 360/4 )
> 
>   Now I have added the requirement that the solution should be as short
>   as possible!

seems a good exercise & you are breaking the students in step by stem 
which is also good
get something that works, then make it better

i would suggest instead of the new requirement to be make it a short as 
possible make it work with ANY number of sides.




-- 
Max told his friend that he'd just as soon not go hiking in the 
hills.
Said he, "I'm an anti-climb Max."
[So is that punchline.]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33338] [lib2to3] Synchronize token.py and tokenize.py with the standard library

2018-09-15 Thread monson


Change by monson :


--
pull_requests: +8757

___
Python tracker 

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



[issue34515] lib2to3: support non-ASCII identifiers

2018-09-15 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 10a428b64b3f224e2ccd40ff2afb141b9b3425b1 by Benjamin Peterson 
(Monson Shao) in branch 'master':
closes bpo-34515: Support non-ASCII identifiers in lib2to3. (GH-8950)
https://github.com/python/cpython/commit/10a428b64b3f224e2ccd40ff2afb141b9b3425b1


--
nosy: +benjamin.peterson
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



[issue34515] lib2to3: support non-ASCII identifiers

2018-09-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8756

___
Python tracker 

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



[issue34686] Add `-r`, as opposed to `-R` to Python core interpreter

2018-09-15 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

On Fri, Sep 14, 2018, at 23:59, Erwan Le Pape wrote:
> 
> Erwan Le Pape  added the comment:
> 
> Great! My only concern with that is marshalling of untrusted data at 
> runtime (I know, you shouldn't do that) can become a much more expensive 
> operation.
> 
> Is there any internal use of marshal beyond .pycs used at runtime by the 
> core interpreter that might be affected by such a change?

Writing pycs is the only supported use of marhsal.

> 
> If not, it seems (to me) an acceptable modification of marshal and I'll 
> submit a PR for it.

What exactly are you proposing?

--

___
Python tracker 

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



[issue34698] urllib.request.Request.set_proxy doesn't (necessarily) replace type

2018-09-15 Thread Tim Burke

New submission from Tim Burke :

Not sure if this is a documentation or behavior bug, but... the docs for 
urllib.request.Request.set_proxy 
(https://docs.python.org/3/library/urllib.request.html#urllib.request.Request.set_proxy)
 say

> Prepare the request by connecting to a proxy server. *The host and type will 
> replace those of the instance*, and the instance’s selector will be the 
> original URL given in the constructor.

(Emphasis mine.) In practice, behavior is more nuanced than that:

>>> from urllib.request import Request
>>> req = Request('http://hostame:port/some/path')
>>> req.host, req.type
('hostame:port', 'http')
>>> req.set_proxy('proxy:other-port', 'https')
>>> req.host, req.type # So far, so good...
('proxy:other-port', 'https')
>>>
>>> req = Request('https://hostame:port/some/path')
>>> req.host, req.type
('hostame:port', 'https')
>>> req.set_proxy('proxy:other-port', 'http')
>>> req.host, req.type # Type doesn't change!
('proxy:other-port', 'https')

Looking at the source 
(https://github.com/python/cpython/blob/v3.7.0/Lib/urllib/request.py#L397) it's 
obvious why https is treated specially.

The behavior is consistent with how things worked on py2...

>>> from urllib2 import Request
>>> req = Request('http://hostame:port/some/path')
>>> req.get_host(), req.get_type()
('hostame:port', 'http')
>>> req.set_proxy('proxy:other-port', 'https')
>>> req.get_host(), req.get_type()
('proxy:other-port', 'https')
>>>
>>> req = Request('https://hostame:port/some/path')
>>> req.get_host(), req.get_type()
('hostame:port', 'https')
>>> req.set_proxy('proxy:other-port', 'http')
>>> req.get_host(), req.get_type()
('proxy:other-port', 'https')


... but only if you're actually inspecting host/type along the way!

>>> from urllib2 import Request
>>> req = Request('https://hostame:port/some/path')
>>> req.set_proxy('proxy:other-port', 'http')
>>> req.get_host(), req.get_type()
('proxy:other-port', 'http')

(FWIW, this came up while porting an application from py2 to py3; there was a 
unit test expecting that last behavior of proxying a https connection through a 
http proxy.)

--
components: Library (Lib)
messages: 325449
nosy: tburke
priority: normal
severity: normal
status: open
title: urllib.request.Request.set_proxy doesn't (necessarily) replace type

___
Python tracker 

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



[issue34697] ctypes: Crash if manually-created CField instance is used

2018-09-15 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

It is possible to manually create an instance of private CField type which is 
used by ctypes to represent fields of Structure and Union types. This instance 
will be uninitialized because it's normally initialized when instances of 
Structure/Union are created, so calling its methods may crash the interpreter:

from ctypes import *

class S(Structure):
_fields_ = [('x', c_int)]

CField = type(S.x)
f = CField()
repr(f) # Crash here

Is this issue worth fixing?

If so, is the correct way to set tp_new slot to NULL and fix the internal 
callers so that users wouldn't be able to create CField instances?

--
components: ctypes
messages: 325448
nosy: amaury.forgeotdarc, belopolsky, berker.peksag, izbyshev, meador.inge, 
serhiy.storchaka
priority: normal
severity: normal
status: open
title: ctypes: Crash if manually-created CField instance is used
type: crash
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



python3.7 - how to open a new thread and close the old each click on a button?

2018-09-15 Thread alon . najman
hii all,
python3.7 - how to open a new thread and close the old each click on a button?
here is my code:


# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'AlonStockMarket.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!


import time
import sys
import requests
from lxml import html
import requests
import urllib.request, urllib.error, urllib.parse
import _thread
from PyQt5 import QtCore, QtGui, QtWidgets


import threading 
global flag
global loopexit

flag=0
loopexit=0

def get_quote(str):
url="https://api.iextrading.com/1.0/stock/"+str+"/price;
resource = urllib.request.urlopen(url)
content =  
resource.read().decode(resource.headers.get_content_charset())
print (content)
content=float(content)
return content

def myfunction():
 global flag
 global loopexit
 print ("Executing myfunction in thread: ")
 print("hello, world")
 while loopexit!=1:
if (loopexit==1):
   break
time.sleep(15)
f=open("flag.txt", "r")
if f.mode == 'r': 
flag =f.read()
timeHour = int(time.strftime('%H'))
print("keep alive")
print (time.strftime('%H:%M:%S'))
while ((timeHour>16) and (timeHour<23) and loopexit!=1):
if (loopexit==1):
 break
print(time.strftime('%H:%M:%S'))
price=get_quote(UserSymbol)
time.sleep(5)
if flag!=time.strftime("%d/%m/%Y") and price>UserStockPrice 
and (RadioButtonAbove==True):
 print ("send SMS")
 import requests
 requests.post('https://textbelt.com/text', {
 'phone': '+972541234567',
 'message': "Hi Alon Najman,EVOK value: "+price,
 'key': 'secret',
 }) 
 #write to file
 with open("flag.txt", "w") as text_file:
 text_file.write(format(time.strftime("%d/%m/%Y")))
 #read from file
 f=open("flag.txt", "r")
 if f.mode == 'r': 
   flag =f.read()

 if flag!=time.strftime("%d/%m/%Y") and 
pricehttps://textbelt.com/text', {
 'phone': '+972546233257',
 'message': "Hi Alon Najman,EVOK value: "+price,
 'key': 'secret',
 }) 
 #write to file
 with open("flag.txt", "w") as text_file:
 
text_file.write(format(time.strftime("%d/%m/%Y")))
 #read from file
 f=open("flag.txt", "r")
 if f.mode == 'r': 
   flag =f.read()  


  

 


from PyQt5 import QtCore, QtGui, QtWidgets

 
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(666, 571)
self.radioButton = QtWidgets.QRadioButton(Dialog)
self.radioButton.setGeometry(QtCore.QRect(80, 190, 191, 24))
font = QtGui.QFont()
font.setPointSize(14)
self.radioButton.setFont(font)
self.radioButton.setObjectName("radioButton")
self.buttonGroup_2 = QtWidgets.QButtonGroup(Dialog)
self.buttonGroup_2.setObjectName("buttonGroup_2")
self.buttonGroup_2.addButton(self.radioButton)
self.checkBox = QtWidgets.QCheckBox(Dialog)
self.checkBox.setGeometry(QtCore.QRect(290, 450, 131, 17))
font = QtGui.QFont()
font.setPointSize(14)
self.checkBox.setFont(font)
self.checkBox.setObjectName("checkBox")
self.checkBox_2 = QtWidgets.QCheckBox(Dialog)
self.checkBox_2.setGeometry(QtCore.QRect(290, 480, 141, 17))
font = QtGui.QFont()
font.setPointSize(14)
self.checkBox_2.setFont(font)
self.checkBox_2.setObjectName("checkBox_2")
self.radioButton_2 = QtWidgets.QRadioButton(Dialog)
self.radioButton_2.setGeometry(QtCore.QRect(300, 190, 186, 24))
font = QtGui.QFont()
font.setPointSize(14)
self.radioButton_2.setFont(font)
self.radioButton_2.setObjectName("radioButton_2")
self.buttonGroup_2.addButton(self.radioButton_2)

[issue34693] PEPping distutils/core.py

2018-09-15 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the report and for the PR, John. Karthikeyan is correct.

Many of the modules in the stdlib predate PEP 8. Also, making PEP 8-only 
changes would make "git blame" less useful and can cause regressions (IIRC it 
has happened at least once, but I don't remember the details at the moment.)

Closing this as 'rejected'. I hope you will continue contributing to Python!

--
nosy: +berker.peksag
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type: compile error -> enhancement

___
Python tracker 

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



[issue30262] Don't expose sqlite3 Cache and Statement

2018-09-15 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Some additional motivation for removing Cache: it may be used to crash the 
interpreter (#31734).

--
nosy: +izbyshev

___
Python tracker 

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



[issue26759] PyBytes_FromObject accepts arbitrary iterable

2018-09-15 Thread Zackery Spytz


Zackery Spytz  added the comment:

I've created #34696 for PyByteArray_FromObject().

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue34696] PyByteArray_FromObject() has undocumented (and untested) behavior

2018-09-15 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue34696] PyByteArray_FromObject() has undocumented (and untested) behavior

2018-09-15 Thread Zackery Spytz


New submission from Zackery Spytz :

The documentation states that PyByteArray_FromObject() creates a bytearray 
object from an object that implements the buffer protocol, but 
PyByteArray_FromObject() simply calls the bytearray constructor with its 
argument (the buffer protocol part is not enforced).

This was mentioned in #26759. Either the documentation or the behavior should 
be changed.

--
messages: 325444
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: PyByteArray_FromObject() has undocumented (and untested) behavior
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue34695] sqlite3: Cache.get() crashes if Cache.__init__() was not called

2018-09-15 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the report and for the patch! This is a duplicate of issue 31734. 
The Cache class is an implementation detail and it has no use of outside of the 
sqlite3 implementation as you already said.

For option 3, there is an open issue: #30262. IMO, the best way to fix this 
issue is to make it private.

--
stage:  -> patch review
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: Fumbling with emacs + elpy + flake8

2018-09-15 Thread Martin Schöön
Den 2018-09-14 skrev Toni Sissala :
> I'm on Ubuntu 16.04. I found out that flake8 did not play well with 
> emacs if installed with --user option, nor when installed in a virtual 
> environment. Didn't research any further, since I got it working with 
> plain pip3 install flake8
>


Toni, your advice did not work out-of-the-box but it put me on the
right track. When I revert to installing flake8 from Debian's repo
it works. Strange as I have not done it like that on my primary
computer. Both Debian installations but a generation apart.

Case closed, I think.

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


[issue34695] sqlite3: Cache.get() crashes if Cache.__init__() was not called

2018-09-15 Thread Berker Peksag


Change by Berker Peksag :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue34695] sqlite3: Cache.get() crashes if Cache.__init__() was not called

2018-09-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue31734.

--
resolution:  -> duplicate
stage: patch review -> 
superseder:  -> crash or SystemError in sqlite3.Cache in case it is 
uninitialized or partially initialized

___
Python tracker 

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



Re: Fumbling with emacs + elpy + flake8

2018-09-15 Thread Martin Schöön
Den 2018-09-13 skrev Brian Oney :
> Hi Martin,
>
> I have messed around alot with the myriad emacs configurations out 
> there. I found spacemacs and threw out my crappy but beloved .emacs
> config. I have looked back, but will stay put. http://spacemacs.org/
>


Thanks Brian but not the answer I was looking for this time. I will
investigate though.

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


[issue30576] http.server should support HTTP compression (gzip)

2018-09-15 Thread Brett Cannon


Brett Cannon  added the comment:

Thanks for the understanding, Pierre (and thanks for the work on Brython!).

On Sat., Sep. 15, 2018, 08:25 Pierre Quentel, 
wrote:

>
> Pierre Quentel  added the comment:
>
> Brett,
>
> Thanks for taking the time, you and other core devs, to review the PR and
> to explain why you took this decision. I am disappointed by the result, but
> I understand the reasons, having to face the same maintenance issues, on a
> much smaller scale, with the project I manage (Brython, an implementation
> of Python for the browser).
>
> I will follow your advice to publish the server on PyPI and cross fingers
> that it gains enough support to be included in a future version.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34695] sqlite3: Cache.get() crashes if Cache.__init__() was not called

2018-09-15 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue34695] sqlite3: Cache.get() crashes if Cache.__init__() was not called

2018-09-15 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

sqlite3.Cache allows users to create uninitialized instances because it relies 
on __init__() instead of __new__() for initialization, which can be skipped. 
Cache.get() crashes if called on an uninitialized instance:

>>> from sqlite3 import Cache
>>> Cache.__new__(Cache, None).get(42)
Segmentation fault (core dumped)

I see the following ways to fix this:

1) Explicitly check that the instance is initialized in Cache methods (this is 
what sqlite3 does for Connection and Cursor).

2) Move initialization from __init__() to __new__(). The latter can't be 
skipped due to Python safety checks. The issue here is that 
pysqlite_cache_init() is declared in Modules/_sqlite/cache.h, and while it's 
not directly called anywhere in Python sources, removing or changing it might 
be considered a change in public API.

3) Remove Cache from sqlite3 module dictionary. It's not clear to me why it's 
there because it's only used internally by Connection, is not documented, and 
there is no API to supply user-created Cache instances to sqlite3. Also, there 
are no tests for Cache.

I'll submit a PR implementing the first (most backwards-compatible) fix, but 
will be happy if (2), (3) or any other more reliable fixes can be considered.

--
components: Extension Modules
messages: 325440
nosy: berker.peksag, ghaering, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: sqlite3: Cache.get() crashes if Cache.__init__() was not called
type: crash
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



[issue34693] PEPping distutils/core.py

2018-09-15 Thread John Joyce


John Joyce  added the comment:

Oh, I see. I did not realize that tidying would not be accepted. That explains 
a lot. As it offended linters based on PEPs I chose that as the best match. It 
is pedantic, but many linting actions are not far from compiling... they are 
generally parsing to determine PEP compliance.

--

___
Python tracker 

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



[issue30140] Binary arithmetic does not always call subclasses first

2018-09-15 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
nosy: +belopolsky

___
Python tracker 

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



[issue30576] http.server should support HTTP compression (gzip)

2018-09-15 Thread Pierre Quentel


Pierre Quentel  added the comment:

Brett,

Thanks for taking the time, you and other core devs, to review the PR and to 
explain why you took this decision. I am disappointed by the result, but I 
understand the reasons, having to face the same maintenance issues, on a much 
smaller scale, with the project I manage (Brython, an implementation of Python 
for the browser).

I will follow your advice to publish the server on PyPI and cross fingers that 
it gains enough support to be included in a future version.

--

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-15 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

There will be no further discussion about this.

--
nosy: +Mariatta
resolution:  -> wont fix
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



[issue34693] PEPping distutils/core.py

2018-09-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the contribution. Is there any syntax error on using the file since 
you have classified it as compile error or the error messages are related to 
linters? On a general note style related contributions are not merged since 
they create whitespace noise while traversing git history. I will let it for 
the reviewers though to decide on this.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you have any concrete propositions?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34694] Dismiss To Avoid Slave/Master wording cause it easier for non English spoken programmers

2018-09-15 Thread Jose Angel Acosta


New submission from Jose Angel Acosta :

A request have been srecentrly uddenly committed to avoid Slave/Master wording 
in python code, I think the "issue"was not enough peer-reviewed, me having 
slave roots from my african and jewish heritage I dont consider this matter an 
Issue, but the Wording Slave/Master widely used to depict component 
relationship is better for understanding the purpose of the component relation 
than the non-traditional wording schemes as Parent/Worker, specially for those 
being non-native English readers the change has issues on code readability 
specially for non-English readers.

Simple, its much easier to understand the meaning of Slave/Master relationship 
in device functionality than Worker/Helper, I consider the whole issue as an 
intrusion of the "politically correct" puritanism in areas where is not 
required.

The main force behind Python success is CODE READABILITY, not  political 
rightfulness, this should be stopped here,Python itself the language name its 
an word which remembers snakes a creature considered impure by both 
Jew/Islamic/Christian religions, by appling the same political rightfulness 
code to this, Python language should be renamed to something non-offensive to 
Jew/Islamic/Christians as Bunny, (and this at least doesnt affect language 
readbility, since "run bunny code" vs "run python code" its easier to 
understand than "Process Master delegate X Data to Slave process" vs "Parent 
process Delegate X Data to Worker Process", the later meaning is not as easy to 
understand, since Parent can be translated in N ways across different 
languages, I.E. Spanish: Parent could means mother, father, cause while Worker 
just means Worker (not intrinsically related to cause or mother).

I think the python language should be kept from explicitly offensive wordings 
not those "niche" offensive wordings when the whole language is named after an 
animal that is offensive on most cultures (And its not a problem), the same 
naming process slave/master doesn't denote support to slavery, are just words 
that its more easy to understand its meaning (given its more uniform) across 
multiple human languages.

I consider the voting mechanism should consider polls among programmers before 
commit matters like this in the future, which respectfully I consider 
ridiculous and I said it with respect to my slave ancestors.

--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Library (Lib), Regular 
Expressions, SSL, Tests, Tkinter, Unicode, Windows, XML, asyncio, ctypes, 
email, macOS
messages: 325434
nosy: AcostaJA, Alex.Willmer, asvetlov, barry, docs@python, dstufft, 
eric.araujo, ezio.melotti, koobs, larry, mrabarnett, ned.deily, paul.moore, 
r.david.murray, ronaldoussoren, steve.dower, terry.reedy, tim.golden, vstinner, 
yselivanov, zach.ware
priority: normal
severity: normal
status: open
title: Dismiss To Avoid Slave/Master wording cause it easier for non English 
spoken programmers
type: enhancement

___
Python tracker 

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



Re: python 3.7 - I try to close the thread without closing the GUI is it possible?

2018-09-15 Thread Michael Torrie
On 09/15/2018 01:23 AM, Albert-Jan Roskam wrote:
>  > I try to close the thread without closing the GUI is it possible?
> 
> 
> Qthread seems to be worth investigating:
> https://medium.com/@webmamoffice/getting-started-gui-s-with-python-pyqt-qthread-class-1b796203c18c

Or better yet, investigate Qt's built-in, asynchronous http request
calls.  I believe the class is QNetworkRequest (and probably other
related classes). This keeps the HTTP request all within the Qt event
loop and eliminates the need for threads.  Additionally it handles all
the problems that might come up, such as connection problems, http
errors, etc.  It looks complicated, but it's simpler than using a thread.

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


Re: python 3.7 - I try to close the thread without closing the GUI is it possible?

2018-09-15 Thread Michael Torrie
Here's a small PyQt example of using Qt's asynchronous facilities:
http://zetcode.com/pyqt/qnetworkaccessmanager/

That should get the original poster started.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33649] asyncio docs overhaul

2018-09-15 Thread Bumsik Kim


Change by Bumsik Kim :


--
pull_requests: +8753

___
Python tracker 

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



[issue34693] PEPping distutils/core.py

2018-09-15 Thread John Joyce


New submission from John Joyce :

In distutils/core.py ...

Line 227 is over-indented, inconsistent with the rest of the file.
Line 226 is over-indented, inconsistent with the rest of the file.

Line 114 is over-indented by 2 characters, inconsistent with the rest of the 
file.
else:
raise SystemExit("error in %s setup command: %s" % \
  (attrs['name'], msg))


Line 113 backslash should not be needed to continue the line between brackets.

Line 102 there is an extra space before the "not" keyword.
if 'script_args'  not in attrs:


Line 57 could use 1 more blank line above it.

Line 33 'script' is assigned but not used.

Line 32 could use 1 more blank line above it.


run_setup and setup had space before (

--
components: Distutils
messages: 325433
nosy: dangerwillrobinsondanger, dstufft, eric.araujo
priority: normal
pull_requests: 8752
severity: normal
status: open
title: PEPping distutils/core.py
type: compile error
versions: Python 3.8

___
Python tracker 

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



[issue34484] Unicode HOWTO incorrectly refers to Private Use Area for surrogateescape

2018-09-15 Thread A.M. Kuchling


A.M. Kuchling  added the comment:

Corrected in the unicode-howto-update branch being developed for issue #20906.

--
assignee: docs@python -> akuchling
nosy: +akuchling

___
Python tracker 

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



[issue20906] Issues in Unicode HOWTO

2018-09-15 Thread A.M. Kuchling


Change by A.M. Kuchling :


--
assignee: docs@python -> akuchling
nosy: +akuchling

___
Python tracker 

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



[issue25296] Simple End-of-life guide covering all unsupported versions

2018-09-15 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

This is not being tracked in:

https://github.com/python/pythondotorg/issues/1302

--
nosy: +Mariatta

___
Python tracker 

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



[issue34656] memory exhaustion in Modules/_pickle.c:1393

2018-09-15 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>>> import pickletools
>>> pickletools.dis(b'\x80\x04\x95\x1d\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x03age\x94K\x17\x8c\x03jobr\x8c\x07student\x94u.')
0: \x80 PROTO  4
2: \x95 FRAME  29
   11: }EMPTY_DICT
   12: \x94 MEMOIZE(as 0)
   13: (MARK
   14: \x8c SHORT_BINUNICODE 'age'
   19: \x94 MEMOIZE(as 1)
   20: KBININT123
   22: \x8c SHORT_BINUNICODE 'job'
   27: rLONG_BINPUT 1953695628
   32: uSETITEMS   (MARK at 13)
   33: dDICT   no MARK exists on stack
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython/Lib/pickletools.py", line 2457, in dis
raise ValueError(errormsg)
ValueError: no MARK exists on stack

Ignore the error of unbalanced MARK. The problem code is LONG_BINPUT with the 
excessive large argument 1953695628. The C implementation of pickle tries to 
resize the the memo list to the size twice larger than this index. And here an 
integer overflow occurred.

This unlikely occurred in real world. The pickle needs to have more than 
2**30-1 ≈ 10**9 memoized items for encountering this bug. It means that its 
size on disk and in memory should be tens or hundreds of gigabytes. Pickle is 
not the best format for serializing such amount of data.

--

___
Python tracker 

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



[issue34579] test_embed.InitConfigTests fail on AIX

2018-09-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d2067318c79f66cfdabc5715a02d5fa5ff81 by Victor Stinner 
(Michael Felt) in branch 'master':
bpo-34579: Fix test_embed DEFAULT_CON AIX (GH-9063)
https://github.com/python/cpython/commit/d2067318c79f66cfdabc5715a02d5fa5ff81


--

___
Python tracker 

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



[issue34663] Support POSIX_SPAWN_USEVFORK flag in posix_spawn

2018-09-15 Thread STINNER Victor


STINNER Victor  added the comment:

Gregory: on Linux, it does change the behavior. The parent blocks until the 
child is spawned. Python should let the developer decide to opt-in.

Serhiy: IMHO it's better to make posix_spawn() as dumb as possible, a simple 
wrapper to the C call. use_vfork=True is currently designed for the GNU 
constant.

posix_spawn(use_vfork=True) raises on FreeBSD: only pass use_vfork=True on 
Linux.

What do you think?

The problem of changing the default is that we don't know the full list of all 
platforms that use vfork() by default. If we have a shoet list, how do we know 
if it's complete? For example, macOS doesn't say anything about vfork. Does it 
use it? Maybe not. Maybe yes. What if the default changes on a platform?

--

___
Python tracker 

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



[issue26979] The danger of PyType_FromSpec()

2018-09-15 Thread Christian Tismer


Christian Tismer  added the comment:

> 1) If I understand correctly, this problem could be solved by
> per-class C storage? Something like PyModuleDef.m_size /
> PyModule_GetState, but for classes?

No. To obtain sizeof(PyType_Type), we simply used the Python code

type.__basicsize__

It is a simple trick, but probably very few people know this path
to get that info. At least, for me it took way too long ;-)


> 2) Making PyType_GetSlot work for static types would not be trivial.
>  All types do have the same *basic* structure (the tp_* fields), but
> the nb_*/sq_*/etc. fields don't need to be in the same order, and
> might not exist at all. Even making it work for the tp_* fields only
> would bake in some assumptions I do want to get rid of.

That's my question. Do you want to hide the fact that some fields
are direct and others are indirect? I don't think that will ever be 
changed before Python 4.0, so why put this burden on every user, then?

I would simply give access to tp_* for all types and that's it.

> I'd like to
> understand your use case better. Do you have a specific example
> here?

Yes. I need access to PyType_Type's tp_new field.

PyType_Type is a very central structure in Python, and it really hurts
to hide every attribute away.

You can see the use of this field here:
https://github.com/pyside/pyside2-setup/blob/5.11/sources/shiboken2/libshiboken/basewrapper.cpp#L319

// The meta type creates a new type when the Python programmer extends a 
wrapped C++ class.
newfunc type_new = reinterpret_cast(PyType_Type.tp_new);
SbkObjectType *newType = 
reinterpret_cast(type_new(metatype, args, kwds));
if (!newType)
return 0;

Not being able to use this field led to many weird workaround attempts, 
which did not really work. We tried to call this function from Python code, 
but then there are several checks which make it impossible to use.

We could maybe generate a heaptype clone of PyType_Type and grab the function
from there. But this is quite obscure and cannot be the recommended way to
get at the tp_new function?

Maybe there also is a way to avoid the use of this function all together.
But we did not want to re-implement a central function of a huge project
that we only understood good enough to change it a bit.

Maybe we approach it again. At that time, it was not even clear that we
would succeed with the limited API. Now that we know, we can try more.

--

___
Python tracker 

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



[issue34692] ok

2018-09-15 Thread arul


New submission from arul :

resloved

On Sat, 15 Sep 2018 at 13:29, Serhiy Storchaka 
wrote:

>
> Change by Serhiy Storchaka :
>
>
> --
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34692] ok

2018-09-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34692] ok

2018-09-15 Thread arul


Change by arul :


--
nosy: arulpython
priority: normal
severity: normal
status: open
title: ok

___
Python tracker 

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



Re: python 3.7 - I try to close the thread without closing the GUI is it possible?

2018-09-15 Thread Albert-Jan Roskam
 > I try to close the thread without closing the GUI is it possible?


Qthread seems to be worth investigating:
https://medium.com/@webmamoffice/getting-started-gui-s-with-python-pyqt-qthread-class-1b796203c18c
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25296] Simple End-of-life guide covering all unsupported versions

2018-09-15 Thread Andreas Lutro


Andreas Lutro  added the comment:

I see this has been closed, but the page on the devguide is still really hard 
to find. On the python IRC channel I often see questions about this and I 
always have a hard time finding the page with the correct information.

If I google "python version support" or "python version end of life" or "python 
version lifecycle" I don't arrive at that page. For some of these searches I 
even end up on a separate devcycle[1] page which only contains old versions of 
python. Compare that to PHP, where the official "supported versions" page is 
the top result no matter what I search for.

Nevermind the fact that the lifecycle of python versions is relevant to 
non-developers as well, making it un-intuitive to go to the devguide to find 
this information.

I really think this needs to be made part of python.org's main website, with 
some good SEO.

[1] https://devguide.python.org/devcycle/

--
nosy: +Andreas Lutro

___
Python tracker 

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



[issue34686] Add `-r`, as opposed to `-R` to Python core interpreter

2018-09-15 Thread Erwan Le Pape


Erwan Le Pape  added the comment:

Great! My only concern with that is marshalling of untrusted data at runtime (I 
know, you shouldn't do that) can become a much more expensive operation.

Is there any internal use of marshal beyond .pycs used at runtime by the core 
interpreter that might be affected by such a change?

If not, it seems (to me) an acceptable modification of marshal and I'll submit 
a PR for it.

--

___
Python tracker 

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



[issue29341] Missing accepting path-like object in docstrings of os module functions

2018-09-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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