[issue32284] typing.TextIO and BinaryIO are not aliases of IO[...]

2017-12-18 Thread Ned Deily

Ned Deily  added the comment:


New changeset 898a3e4901b3b6de9b540e18faa457a6ac3e49bb by Ned Deily (Miss 
Islington (bot)) in branch '3.6':
bpo-32284: Fix documentation of BinaryIO and TextIO (GH-4832) (#4833)
https://github.com/python/cpython/commit/898a3e4901b3b6de9b540e18faa457a6ac3e49bb


--

___
Python tracker 

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



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

2017-12-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue19100] Use backslashreplace in pprint

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Try with LANG=en_US.

And even UTF-8 can fail.

--

___
Python tracker 

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



[issue32324] [Security] "python3 directory" inserts "directory" at sys.path[0] even in isolated mode

2017-12-18 Thread Steve Dower

Steve Dower  added the comment:

> A compromise would be to refuse to start on "python3 -I directory" to remain 
> secure

What would that achieve, considering that "python3 -I directory/__main__.py" 
would let you start with exactly the same sys.path?[*]

The only change that might be of any value would be to resolve the path as 
early as possible so that an absolute path is added to sys.path[0]. 

Not adding the directory of the startup script is a breaking change with no 
security benefits -- it has to stay there. -I is not a protection against 
command-line arguments.

[*] On Windows, using the filename seems to resolve the directory while using 
just the directory name does not. I'm not sure why they aren't identical, and 
obviously I think they should be, but I'd expect the initialization work to 
streamline it (when getpath.c becomes sensible).

--

___
Python tracker 

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



[issue31094] asyncio: get list of connected clients

2017-12-18 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

This tracker is not the best place for questions about development *with* 
Python -- it is for questions for development *of* Python itself.
Please use resources like StackOverflow next time.

`asyncio.Server.sockets` is a list of connected socket objects -- but usually 
Protocol implementation handles a list of alive clients separately, 
protocol.connection_made() and protocol.connection_lost() allows to do it easy.

--
nosy: +asvetlov
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



Re: correctness proof for alpha-beta algorithm

2017-12-18 Thread Terry Reedy

On 12/19/2017 1:01 AM, namenobodywa...@gmail.com wrote:


can anybody tell me where to look for a proof of the correctness of a 
minimax/negamax algorithm with alpha-beta pruning? thanks if you can help


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

--
Terry Jan Reedy

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


[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

'int' is a standin for non-iterable and easy to type.

--

___
Python tracker 

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



correctness proof for alpha-beta algorithm

2017-12-18 Thread namenobodywants
hi all

can anybody tell me where to look for a proof of the correctness of a 
minimax/negamax algorithm with alpha-beta pruning? thanks if you can help

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


[issue32370] Wrong ANSI encoding used by subprocess for some locales

2017-12-18 Thread Eryk Sun

Eryk Sun  added the comment:

ipconfig uses (or defaults to) OEM encoded output when writing to a pipe or 
file. On the other hand, Python's TextIOWrapper defaults to ANSI (i.e. 'mbcs'). 
In 3.6+, uuid._ipconfig_getnode could be rewritten to call subprocess.Popen 
with the new 'oem' encoding. 

In Windows 10, the networking command-line utilities (e.g. ipconfig, netstat, 
nbtstat, ping, tracert, hostname, finger, and ftp) support an "OutputEncoding" 
environment variable. Its value can be set to "Unicode" (UTF-16), "UTF-8", or 
"Ansi". I don't think this is supported in Windows 7, however.

--
nosy: +eryksun

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


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

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

About the only use case I can come up with is subclassing asyncio.Task and 
overriding set_result and set_exception implementations.  This use case has 
been broken (unintentionally) in Python 3.6, when we first implemented Task in 
_asynciomodule.c.  C Task doesn't try to resolve 'self.set_result()' or 
'self.set_exception()'.  It calls the C "super" implementations instead.

--

___
Python tracker 

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



[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Camion

Camion  added the comment:

thank You Serhiy for your C implementation. 

About this question of the dilemma around the meaning of "non iterable int" why 
not simply put the "non iterable" between parenthesis to avoid making it too 
verbose ?

"cannot unpack (non-iterable) int object"
or "cannot unpack int object (not iterable)

However, I wonder why nearly all the changes I've seen, seem to be about int ? 
This situation might arise with any non-iterable type (I got it first with 
Fraction).

--

___
Python tracker 

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



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

2017-12-18 Thread Camion

Camion  added the comment:

Oops, in my previous post please read : 

"but does it makes sense to have the presence of "global a" in g, block all 
possibility for h, to access it's grand parent's a ?"

instead of

"but is makes sense to [...] grand parent's a."

--

___
Python tracker 

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



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

2017-12-18 Thread Camion

Camion  added the comment:

Well, David, I'm convinced this behavior is "logical" and is not some "logic" 
flaw. My question is more about the fact that it is desirable and was 
intentionally designed that way,or if on the contrary no one thought it might 
happen that way and it's not what was wished.

I understand that it might be a problem to link to a global (global a), a 
variable (h's a) which was declared in a non-global way, but is makes sense to 
have the presence of "global a" in g, block all possibility for h, to access 
it's grand parent's a.

In all case, I believe this should at lease be clearly documented in (or in 
relation with) PEP 3104 to make sure it has been decided that way, or else it 
will look like a design hole.

--

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

Actually, I don't think we need a deprecation period.  Both methods are 
completely unusable now.

Given:

  async def foo():
await asyncio.sleep(1)
print('A')
return 42


1. Let's try to use Task.set_result():

  async def main():
f = asyncio.create_task(foo())
f.set_result(123)
result = await f
print(result)

  asyncio.run(main())

This will print "123", but will give us an "AssertionError: _step(): already 
done:  result=123> None" logged.


2. Let's try set_result + a sleep:

  async def main():
f = asyncio.create_task(foo())
await asyncio.sleep(2)
f.set_result(123)
result = await f
print(result)


  asyncio.run(main())

This just crashes with an InvalidStateError.

3. Same happens with set_exception().


All in all, deprecation periods are useful when there's some working and useful 
functionality that has to be removed in the future.  In this case there's no 
working and no useful functionality.

So let's just make Task.set_result() and Task.set_exception() raise 
NotImplementedError.

--

___
Python tracker 

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



[issue32216] Document PEP 557 Data Classes

2017-12-18 Thread Christopher Barker

Christopher Barker  added the comment:

It was suggested that I could contirbute to the docs of dataclasses in this 
issue. Which confuses me, as there doesn't appear to be any content here to 
comment on. But what the heck:

As I've been annoyingly persistent about on the python-dev list, I think we 
need to be quite careful about making type hints appear to be a requirement for 
using dataclasses. In order to counter this, we could:

* have the first couple example be type-less:

@dataclass
class C:
a: ...   # field without a default
b: ... = 0 # field with a default

or something like that.

Then purposely introduce "how to add type hints" a bit down in the docs.

--
nosy: +Chris.Barker

___
Python tracker 

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



[issue32354] Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER

2017-12-18 Thread Campbell Barton

Campbell Barton  added the comment:

Thanks for the info, in that case will there be a way to do this from the 
CPython API which can work with raw strings? (utf8, wchat_t or similar types), 
that doesn't require the GIL and alloc/free of PyObjects.

--

___
Python tracker 

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



[issue27456] asyncio: set TCP_NODELAY flag by default

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +4817

___
Python tracker 

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



[issue32331] Fix socket.type on OSes with SOCK_NONBLOCK

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

> In this case, bpo-27456 should be reopened or a new issue should be opened to 
> fix asyncio in Python 3.6, no?

I'll make a PR to fix it in 3.7.  Code in 3.6 is good.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-18 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4816

___
Python tracker 

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



[issue32331] Fix socket.type on OSes with SOCK_NONBLOCK

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> This is 3.7 only change.

In this case, bpo-27456 should be reopened or a new issue should be opened to 
fix asyncio in Python 3.6, no?

--

___
Python tracker 

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



[issue32331] Fix socket.type on OSes with SOCK_NONBLOCK

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


--
title: Fix socket.type on Linux -> Fix socket.type on OSes with SOCK_NONBLOCK

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

I've merged the PR.

Summary of the final change:

1. socket.socket(family, type, proto) constructor clears SOCK_NONBLOCK and 
SOCK_CLOEXEC from 'type' before assigning it to 'sock.type'.

2. socket.socket(family, SOCK_STREAM | SOCK_NONBLOCK) will still create a 
non-blocking socket.

3. socket.setblocking() no longer sets/unsets SOCK_NONBLOCK flag on sock.type.

This is 3.7 only change.

Big thanks to Nathaniel and Victor for the help!

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 9818142b1bd20243733a953fb8aa2c7be314c47c by Yury Selivanov in 
branch 'master':
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877)
https://github.com/python/cpython/commit/9818142b1bd20243733a953fb8aa2c7be314c47c


--

___
Python tracker 

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



[issue11574] TextIOWrapper: Unicode Fallback Encoding on Python 3.3

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue13643] 'ascii' is a bad filesystem default encoding

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue19100] Use backslashreplace in pprint

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

$ LANG= ./python -c "import pprint; pprint.pprint('\u20ac')"

Thanks to the PEP 538 and PEP 540, this command now works as expected in Python 
3.7:

vstinner@apu$ LANG= python3.7 -c "import pprint; pprint.pprint('\u20ac')"
'€'

Do we still need pprint_unencodable_2.patch workaround?

--
nosy: +vstinner

___
Python tracker 

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



[issue32324] [Security] "python3 directory" inserts "directory" at sys.path[0] even in isolated mode

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

A compromise would be to refuse to start on "python3 -I directory" to remain 
secure and respect -I documentation:

https://docs.python.org/dev/using/cmdline.html#id2

"In isolated mode sys.path contains neither the script’s directory nor the 
user’s site-packages directory."

Example of error message:

"Running a Python package is incompatible with the isolated mode (-I option)"

--

___
Python tracker 

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



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

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

I read again the whole issue and I dislike the "time.clock becomes an alias to 
time.perf_counter" idea. Calling time.clock() now emits a deprecation warning, 
the issue is fixed, so I close it.

Many discussions were about removal of the function. IHMO it's out of the scope 
of this specific issue and should be discussed later, once someone will propose 
to remove time.clock().

--
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: async serial port in Python.

2017-12-18 Thread John Pote



On 18/12/2017 23:20, Les Cargill wrote:


What I'd like to do is set up *some* sort of method in Python to
asynchronously use callbacks to receive characters from a serial port
or 20 serial ports.

If I have to hook an event loop or even spawn a thread - fine! but it
needs to allow for making things event-driven. For lack of a better
term, I'd like this to at least have "select()/epoll() semantics".

And then I'd like to extend that to TCP and UDP ports.

Is this even possible? I keep running into "not done yet"
stuff on this front, but I'm not very up on Python. It may
be ... what's the term ... ? ... un-Pythonic, and I would accept
that as an explanation.


And no, I do not have a pet distro or version of Python. Any is fine
with me.
I've use Chris Liechti's pySerial very successfully several times on 
Python 2.7 and earlier and just a test with 3.6. Easy enough to access 
it from Python threads. I'm stuck with Windoze so have used COMx: port 
access to both PC native serial port (I have old kit) and USB virtual 
serial ports. No idea about xNix.




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


[issue32370] Wrong ANSI encoding used by subprocess for some locales

2017-12-18 Thread Segev Finer

New submission from Segev Finer :

The following test is failing randomly for me (python -m test test_uuid -v):
==
ERROR: test_ipconfig_getnode (test.test_uuid.TestInternalsWithoutExtModule)
--
Traceback (most recent call last):
  File "cpython\lib\test\test_uuid.py", line 551, in test_ipconfig_getnode
node = self.uuid._ipconfig_getnode()
  File "cpython\lib\uuid.py", line 487, in _ipconfig_getnode
for line in pipe:
  File "cpython\lib\encodings\cp1255.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 682: 
character maps to 

This is caused by trying to decode the output of "ipconfig" using cp1255, while 
the output really uses cp862 and annoyingly it started to print times using the 
current locale (Which displays broken in the console anyhow, question mark 
boxes... *sigh*) in some Windows version (Using Windows 10.0.16299 ATM).

--
components: Windows
messages: 308597
nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Wrong ANSI encoding used by subprocess for some locales
type: behavior
versions: Python 3.7

___
Python tracker 

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



Re: __contains__ classmethod?

2017-12-18 Thread MRAB

On 2017-12-18 21:25, Tim Chase wrote:

Playing around, I had this (happens to be Py2, but gets the same
result in Py3) code

class X(object):
   ONE = "one"
   TWO = "two"
   _ALL = frozenset(v for k,v in locals().items() if k.isupper())
   @classmethod
   def __contains__(cls, v):
 return v in cls._ALL
print(dir(X))
print(X._ALL)

Running this gives

   ['ONE', 'TWO', '_ALL', '__class__', '__contains__', '__delattr__',
   '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
   '__getattribute__', '__gt__', '__hash__', '__init__', '__le__',
   '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
   '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
   '__str__', '__subclasshook__', '__weakref__']

And then, depending on whether it's Py2 or Py3, I get either

   frozenset({'one', 'two'})
   frozenset(['two', 'one'])

Which I expect.  Hey, look. There's a __contains__ method. And it
has been specified as a @classmethod.  So I want to test it:

   print("one" in X)

However that fails with

   Traceback (most recent call last):
 File "x.py", line 10, in 
   print("one" in X)
   TypeError: argument of type 'type' is not iterable

My understanding was that "in" makes use of an available __contains__
but something seems to preventing Python from finding that.

What's going on here?

Maybe it's just because it's intended to be an instance method, like 
__getitem__.

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


[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I retested and iter(ob) (1) apparently raises 'not iterable' only when it can 
find neither __iter__ nor __getitem__.  It (2) raises 'non-iterator', as above, 
when it finds  __iter__, calls its, and get a non-iterator.  (3) Exceptions in 
__iter__ are passed through.  (If it finds and wraps __getitem__, errors only 
appear during iteration.)

The current patch for assignment unpacking catches case (1) with 
"v->ob_type->tp_iter == NULL && !PySequence_Check(v))".  Removing this would 
catch case (2) and incidentally case (3) TypeErrors.  Not catching user 
TypeErrors would require looking at the message.  I intentionally am not 
proposing to remove the TypeError check.

Presuming the existence of a PyErr_' function to get exception messages, we 
could simply prefix the existing message with a short 'Cannot unpack. '  The 
same could be done for the other cases in msg307999, but I don't know if they 
are subject to the same need.

--

___
Python tracker 

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



Re: async serial port in Python.

2017-12-18 Thread Les Cargill

Les Cargill wrote:


What I'd like to do is set up *some* sort of method in Python to
asynchronously use callbacks to receive characters from a serial port
or 20 serial ports.

If I have to hook an event loop or even spawn a thread - fine! but it
needs to allow for making things event-driven. For lack of a better
term, I'd like this to at least have "select()/epoll() semantics".

And then I'd like to extend that to TCP and UDP ports.

Is this even possible? I keep running into "not done yet"
stuff on this front, but I'm not very up on Python. It may
be ... what's the term ... ? ... un-Pythonic, and I would accept
that as an explanation.


And no, I do not have a pet distro or version of Python. Any is fine
with me.



The Brent Welch book for Tcl has a totally complete example of this
laid out in great detail. That's so 15-20 years ago - try to catch
up, guys :)




Update: Found this:

http://pyserial-asyncio.readthedocs.io/en/latest/index.html

Seems to work. It's still "experimental"?

--
Les Cargill



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


[issue32245] OSError: raw write() returned invalid length on latest Win 10 Consoles

2017-12-18 Thread Segev Finer

Segev Finer  added the comment:

Upstream issue https://github.com/Microsoft/console/issues/40, also has links 
to similar issues this caused in other projects.

--
nosy: +Segev Finer

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Bill

Christian Gollwitzer wrote:


You don't need to explain a vtable to explain dynamic_cast. Only if 
you want to become a compiler writer. It is not even required, vtables 
are just the most common implementation.


dynamic_cast simply checks if the actual object that the pointer 
points to is an instance of a derived class, and then casts it into 
that. You could "explain" it with the following pseudo-code


template 
T* dynamic_cast(base *input) {
if (isinstanceof(base, *input)) { return (T*)input; }
else { return nullptr; }
}

How that works (particularly the "isinstanceof") is not the business 
of the programmer - it is sufficient to know that the compiler 
somewhere stores this information for every object.


Christian


With that, the students would "boo you off the stage!"... and maybe 
accuse you of being a "know it all".  ; )The point of college is 
more about teaching students to think rather than in being efficient.  I 
have little doubt that a tech school could "get through everything" much 
faster.


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


[issue32359] Add getters for all SSLContext internal configuration

2017-12-18 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Yeah, I'm not entirely sure whether fixing this is actually doable or 
worthwhile, but figured I should at least make an issue to discuss :-).

The problem is, in the motivating use case of wanting to be able to reliably 
convert an SSLContext into some other representation, we really need to be able 
to get 100% of the configuration out. I think the trust configuration can 
probably be handled in principle by remembering the arguments to any calls to 
load_verify_locations, so they can be replayed later. But... that won't work 
for private keys, because if they're password-protected then replaying a call 
to load_cert_chain will end up prompting for the password twice. So maybe we 
really would need a way to pull out the actual private key bits. And if we 
can't do that, then maybe it's not worth stressing about the other stuff 
either...

--

___
Python tracker 

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



async serial port in Python.

2017-12-18 Thread Les Cargill


What I'd like to do is set up *some* sort of method in Python to
asynchronously use callbacks to receive characters from a serial port
or 20 serial ports.

If I have to hook an event loop or even spawn a thread - fine! but it
needs to allow for making things event-driven. For lack of a better
term, I'd like this to at least have "select()/epoll() semantics".

And then I'd like to extend that to TCP and UDP ports.

Is this even possible? I keep running into "not done yet"
stuff on this front, but I'm not very up on Python. It may
be ... what's the term ... ? ... un-Pythonic, and I would accept
that as an explanation.


And no, I do not have a pet distro or version of Python. Any is fine
with me.



The Brent Welch book for Tcl has a totally complete example of this
laid out in great detail. That's so 15-20 years ago - try to catch
up, guys :)



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


Re: [OT] Python and Excel

2017-12-18 Thread Les Cargill

oliver wrote:

That would be amazing. I still have nightmares of when I had to create this
big options analysis VBA program in Excel 2007.




Odd - I haven't found VBA itself to be all that horrible. Yeah, it's got 
some serious weaknesses but it jut hasn't bit me badly, yet. Then again,

it's not something I do a lot of.



On Mon, Dec 18, 2017, 14:21 MRAB,  wrote:


Those who use Excel might find this interesting:

Microsoft Considers Adding Python as an Official Scripting Language to
Excel

https://www.bleepingcomputer.com/news/microsoft/microsoft-considers-adding-python-as-an-official-scripting-language-to-excel/
--
https://mail.python.org/mailman/listinfo/python-list



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


Re: Python Learning

2017-12-18 Thread Rob Gaddi

On 12/18/2017 01:52 PM, Gene Heskett wrote:

On Monday 18 December 2017 16:05:10 Rob Gaddi wrote:


On 12/18/2017 08:45 AM, Larry Martell wrote:

On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa 

wrote:

However, one great way to stand out is a portfolio of GitHub
projects. Several people have gotten an offer largely based on
those (after they aced the technical interviews). For example, we
just hired someone who had written a game in sed. That doesn't make
him an "interesting person," nor do we look for game or sed
developers. But that silly exercise deeply resonated with our team.
We expect to have great synergy with him.


I have been excluded from even getting an interview because I did
not have a portfolio of GitHub projects. I think that is a bad
filter. I work 60-70 hours a week for pay, and I have a family and
personal interests.


When I'm hiring I don't necessarily need a candidate to have an
extensive open-source portfolio, but I need to see some kind of
portfolio, just as a bar of "This is what I consider my good work to
be."  The idea that someone is going to have years of experience, but
not a single page of code that they can let me look over always
strikes me as odd.


I've known Larry for years via another list. He has worked on a lot of
stuff in the financial arena, wrapped in non-disclosure clauses that
prevent him from even saying what color he dots the i's with, so he gets
work as much by word of mouth as other more conventional paths.

To not hire him because he doesn't have a big portfolio could be a
mistake, Rob. Its up to you.

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



Cheers, Gene Heskett



Not a big portfolio, anything.  Shell scripts that you're using to 
simplify your home login.  The garage door monitor you rigged up from an 
Arduino.  The Python script I wrote to fill a USB stick with a randomly 
chosen selection of MP3s.


I as well don't have a huge portfolio of GitHub projects that I spend my 
life maintaining, but I refuse to believe any of us get away with not 
writing any code outside out professional lives.  Personally, I'd argue 
I can get a better read of a programmer from the 120 line toy they 
tossed off one day to solve an immediate need than I can from the 50 
kLOC proprietary project they share with two other developers and are 
NDAed to the hilt on.


And as for Larry in particular, he's posted a portfolio's worth of code 
to this mailing list just in trying to help folks through their issues. 
For an actual interview I'd want it cleaned up to what he'd consider to 
be acceptable documentation standards for a project, but "demonstrate 
competence" is a well-cleared bar.  I just don't have any work at the 
moment that would justify bringing that big a cannon to bear.


So I stick to my point.  If you have literally nothing that you can show 
me at an interview, I'm dubious.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


[issue32030] PEP 432: Rewrite Py_Main()

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 6efcb6d3d5911aaf699f9df3bb3bc26e94f38e6d by Victor Stinner in 
branch 'master':
bpo-32030: Fix compilation on FreeBSD, #include  (#4919)
https://github.com/python/cpython/commit/6efcb6d3d5911aaf699f9df3bb3bc26e94f38e6d


--

___
Python tracker 

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



Re: __contains__ classmethod?

2017-12-18 Thread Peter Otten
Peter Otten wrote:

> Tim Chase wrote:
> 
>> Playing around, I had this (happens to be Py2, but gets the same
>> result in Py3) code
>> 
>> class X(object):
>>   ONE = "one"
>>   TWO = "two"
>>   _ALL = frozenset(v for k,v in locals().items() if k.isupper())
>>   @classmethod
>>   def __contains__(cls, v):
>> return v in cls._ALL
>> print(dir(X))
>> print(X._ALL)
>> 
>> Running this gives
>> 
>>   ['ONE', 'TWO', '_ALL', '__class__', '__contains__', '__delattr__',
>>   '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
>>   '__getattribute__', '__gt__', '__hash__', '__init__', '__le__',
>>   '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
>>   '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
>>   '__str__', '__subclasshook__', '__weakref__']
>> 
>> And then, depending on whether it's Py2 or Py3, I get either
>> 
>>   frozenset({'one', 'two'})
>>   frozenset(['two', 'one'])
>> 
>> Which I expect.  Hey, look. There's a __contains__ method. And it
>> has been specified as a @classmethod.  So I want to test it:
>> 
>>   print("one" in X)
>> 
>> However that fails with
>> 
>>   Traceback (most recent call last):
>> File "x.py", line 10, in 
>>   print("one" in X)
>>   TypeError: argument of type 'type' is not iterable
>> 
>> My understanding was that "in" makes use of an available __contains__
>> but something seems to preventing Python from finding that.
>> 
>> What's going on here?
> 
> Like __next__ method is looked up in the class, and for the class X that
> would be its metaclass, type. 

Sorry, I realize that this sentence is impossible to understand. Random832 
states the problem more clearly.

[Digression] I mentioned the __next__() method specifically because I 
remembered that you could override its predecessor next() in the instance. 
However, the examples below demonstrate that this behaviour is limited to 
classic classes:

>>> def demo(C):
... c = C()
... c.next = lambda: 42
... for x in c:
... print x
... break
... 
>>> class A:
... def __iter__(self):
... return self
... def next(self):
... return "class"
... 
>>> demo(A)
42
>>> class B(A, object): pass
... 
>>> demo(B)
class


> So you have to adjust that:
> 
> $ cat contains.py
> class XType(type):
> def __contains__(cls, v):
> print("metaclass")
> return v in cls._ALL
> 
> 
> class X(metaclass=XType):
> ONE = "one"
> TWO = "two"
> _ALL = frozenset(v for k, v in locals().items() if k.isupper())
> 
> @classmethod
> def __contains__(cls, v):
> print("instance")

This should rather be

  print("class")

> return v in cls
> 
> print("one" in X, "one" in X())
> print("three" in X, "three" in X())
> $ python3 contains.py
> metaclass
> instance
> metaclass
> True True
> metaclass
> instance
> metaclass
> False False


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


[issue32331] Fix socket.type on Linux

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

The most portable solution seems to getsockopt():

>>> s.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE)
1

But I would prefer to avoid a syscall just to clear flags :-/

--

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

> But I would prefer to avoid a syscall just to clear flags :-/

Yes, that's what I want to do.

We control what constants the socket module exports. Let's just clear them if 
we export them -- that's a good working solution (and also the most backwards 
compatible, as opposed to calling sock.getsockopt)

--

___
Python tracker 

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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

> This issue is not specific to Linux. FreeBSD is also affected:

So instead of '#ifdef __linux__' we should use `#ifdef SOCK_NONBLOCK` etc.  
I'll update the PR.

--

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 4:52 PM, Gene Heskett  wrote:
> On Monday 18 December 2017 16:05:10 Rob Gaddi wrote:
>
>> On 12/18/2017 08:45 AM, Larry Martell wrote:
>> > On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa 
> wrote:
>> >> However, one great way to stand out is a portfolio of GitHub
>> >> projects. Several people have gotten an offer largely based on
>> >> those (after they aced the technical interviews). For example, we
>> >> just hired someone who had written a game in sed. That doesn't make
>> >> him an "interesting person," nor do we look for game or sed
>> >> developers. But that silly exercise deeply resonated with our team.
>> >> We expect to have great synergy with him.
>> >
>> > I have been excluded from even getting an interview because I did
>> > not have a portfolio of GitHub projects. I think that is a bad
>> > filter. I work 60-70 hours a week for pay, and I have a family and
>> > personal interests.
>>
>> When I'm hiring I don't necessarily need a candidate to have an
>> extensive open-source portfolio, but I need to see some kind of
>> portfolio, just as a bar of "This is what I consider my good work to
>> be."  The idea that someone is going to have years of experience, but
>> not a single page of code that they can let me look over always
>> strikes me as odd.
>
> I've known Larry for years via another list. He has worked on a lot of
> stuff in the financial arena, wrapped in non-disclosure clauses that
> prevent him from even saying what color he dots the i's with, so he gets
> work as much by word of mouth as other more conventional paths.

True story.

> To not hire him because he doesn't have a big portfolio could be a
> mistake, Rob. Its up to you.

Thank you my friend.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 4:05 PM, Rob Gaddi
 wrote:
> On 12/18/2017 08:45 AM, Larry Martell wrote:
>>
>> On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  wrote:
>>>
>>> However, one great way to stand out is a portfolio of GitHub projects.
>>> Several people have gotten an offer largely based on those (after they
>>> aced the technical interviews). For example, we just hired someone who
>>> had written a game in sed. That doesn't make him an "interesting
>>> person," nor do we look for game or sed developers. But that silly
>>> exercise deeply resonated with our team. We expect to have great synergy
>>> with him.
>>
>>
>> I have been excluded from even getting an interview because I did not
>> have a portfolio of GitHub projects. I think that is a bad filter. I
>> work 60-70 hours a week for pay, and I have a family and personal
>> interests.
>>
>
> When I'm hiring I don't necessarily need a candidate to have an extensive
> open-source portfolio, but I need to see some kind of portfolio, just as a
> bar of "This is what I consider my good work to be."  The idea that someone
> is going to have years of experience, but not a single page of code that
> they can let me look over always strikes me as odd.

I have lots of code and projects to show, but only on my computer. I
once got a django/python job because I had a PHP app I did to show.
But if they had not interviewed me because I had nothing on a public
site they never would have seen it.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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



[issue32331] Fix socket.type on Linux

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

This issue is not specific to Linux. FreeBSD is also affected:

>>> s=socket.socket()
>>> s.type

>>> s.setblocking(False)
>>> s.type
536870913

See for example https://sourceware.org/ml/libc-alpha/2013-08/msg00528.html

--

___
Python tracker 

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



[issue20891] PyGILState_Ensure on non-Python thread causes fatal error

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

I ran pyperformance on my PR 4700. Differences of at least 5%:

haypo@speed-python$ python3 -m perf compare_to 
~/json/uploaded/2017-12-18_12-29-master-bd6ec4d79e85.json.gz 
/home/haypo/json/patch/2017-12-18_12-29-master-bd6ec4d79e85-patch-4700.json.gz 
--table --min-speed=5

+--+--+-+
| Benchmark| 2017-12-18_12-29-master-bd6ec4d79e85 | 
2017-12-18_12-29-master-bd6ec4d79e85-patch-4700 |
+==+==+=+
| pathlib  | 41.8 ms  | 44.3 ms: 1.06x 
slower (+6%) |
+--+--+-+
| scimark_monte_carlo  | 197 ms   | 210 ms: 1.07x 
slower (+7%)  |
+--+--+-+
| spectral_norm| 243 ms   | 269 ms: 1.11x 
slower (+11%) |
+--+--+-+
| sqlite_synth | 7.30 us  | 8.13 us: 1.11x 
slower (+11%)|
+--+--+-+
| unpickle_pure_python | 707 us   | 796 us: 1.13x 
slower (+13%) |
+--+--+-+

Not significant (55): 2to3; chameleon; chaos; (...)

--

___
Python tracker 

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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


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



[issue32356] asyncio: Make transport.pause_reading()/resume_reading() idempotent; add transport.is_reading()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset d757aaf9dd767d13205bf9917e520ebf43e7f6e5 by Yury Selivanov in 
branch 'master':
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)
https://github.com/python/cpython/commit/d757aaf9dd767d13205bf9917e520ebf43e7f6e5


--

___
Python tracker 

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



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

2017-12-18 Thread Brett Cannon

Brett Cannon  added the comment:

Yep, I assumed implementing the ReourceReader API would be a separate step.

As for the type hints, I thought it was lifted such that new code could include 
it but we wouldn't be taking PRs to add them to pre-existing code?

--

___
Python tracker 

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



Re: __contains__ classmethod?

2017-12-18 Thread Random832
On Mon, Dec 18, 2017, at 16:25, Tim Chase wrote:
> My understanding was that "in" makes use of an available __contains__
> but something seems to preventing Python from finding that.
> 
> What's going on here?

Most __ methods have to be an actual method on the class object, which
means you have to use a metaclass.

"one" in X() works, but to get "one" in X to work, you need:

class M(type):
   def __contains__(cls, v):
 return v in cls._ALL

class X(object, metaclass=M):
   ONE = "one"
   TWO = "two"
   _ALL = frozenset(v for k,v in locals().items() if k.isupper())

If you want *both* "one" in X and "one" in X() to work, I think you
pretty much have to define it in both places.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-18 Thread Gene Heskett
On Monday 18 December 2017 16:05:10 Rob Gaddi wrote:

> On 12/18/2017 08:45 AM, Larry Martell wrote:
> > On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  
wrote:
> >> However, one great way to stand out is a portfolio of GitHub
> >> projects. Several people have gotten an offer largely based on
> >> those (after they aced the technical interviews). For example, we
> >> just hired someone who had written a game in sed. That doesn't make
> >> him an "interesting person," nor do we look for game or sed
> >> developers. But that silly exercise deeply resonated with our team.
> >> We expect to have great synergy with him.
> >
> > I have been excluded from even getting an interview because I did
> > not have a portfolio of GitHub projects. I think that is a bad
> > filter. I work 60-70 hours a week for pay, and I have a family and
> > personal interests.
>
> When I'm hiring I don't necessarily need a candidate to have an
> extensive open-source portfolio, but I need to see some kind of
> portfolio, just as a bar of "This is what I consider my good work to
> be."  The idea that someone is going to have years of experience, but
> not a single page of code that they can let me look over always
> strikes me as odd.

I've known Larry for years via another list. He has worked on a lot of 
stuff in the financial arena, wrapped in non-disclosure clauses that 
prevent him from even saying what color he dots the i's with, so he gets 
work as much by word of mouth as other more conventional paths.

To not hire him because he doesn't have a big portfolio could be a 
mistake, Rob. Its up to you.
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order.  See above to fix.


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: __contains__ classmethod?

2017-12-18 Thread Peter Otten
Tim Chase wrote:

> Playing around, I had this (happens to be Py2, but gets the same
> result in Py3) code
> 
> class X(object):
>   ONE = "one"
>   TWO = "two"
>   _ALL = frozenset(v for k,v in locals().items() if k.isupper())
>   @classmethod
>   def __contains__(cls, v):
> return v in cls._ALL
> print(dir(X))
> print(X._ALL)
> 
> Running this gives
> 
>   ['ONE', 'TWO', '_ALL', '__class__', '__contains__', '__delattr__',
>   '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
>   '__getattribute__', '__gt__', '__hash__', '__init__', '__le__',
>   '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
>   '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
>   '__str__', '__subclasshook__', '__weakref__']
> 
> And then, depending on whether it's Py2 or Py3, I get either
> 
>   frozenset({'one', 'two'})
>   frozenset(['two', 'one'])
> 
> Which I expect.  Hey, look. There's a __contains__ method. And it
> has been specified as a @classmethod.  So I want to test it:
> 
>   print("one" in X)
> 
> However that fails with
> 
>   Traceback (most recent call last):
> File "x.py", line 10, in 
>   print("one" in X)
>   TypeError: argument of type 'type' is not iterable
> 
> My understanding was that "in" makes use of an available __contains__
> but something seems to preventing Python from finding that.
> 
> What's going on here?

Like __next__ method is looked up in the class, and for the class X that 
would be its metaclass, type. So you have to adjust that:

$ cat contains.py
class XType(type):
def __contains__(cls, v):
print("metaclass")
return v in cls._ALL


class X(metaclass=XType):
ONE = "one"
TWO = "two"
_ALL = frozenset(v for k, v in locals().items() if k.isupper())

@classmethod
def __contains__(cls, v):
print("instance")
return v in cls

print("one" in X, "one" in X())
print("three" in X, "three" in X())
$ python3 contains.py 
metaclass
instance
metaclass
True True
metaclass
instance
metaclass
False False


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


Re: Recommended pypi caching proxy?

2017-12-18 Thread Ray Cote
On Mon, Dec 18, 2017 at 1:00 PM, Matt Wheeler  wrote:

> On Mon, 18 Dec 2017, 15:45 Ray Cote, 
> wrote:
>
>> Looking to deploy a locally cached pypi proxy service.
>>
>> Is there a recommended/preferred pypi caching tool?
>> I’ve found:
>>   - proxypypy
>>   - Flask-Pypi-Proxy
>>   - pypicache
>>
>> All of which seem to have generally the same functionality and all of
>> which
>> are a few years old.
>> Recommendations from the crowd?
>>
>
> In the past I've used https://github.com/devpi/devpi
> It may have many features you don't need if all you're after is a caching
> proxy, but I found it does that well and it appears to still be pretty
> active.
>
>> --
>
> --
> Matt Wheeler
> http://funkyh.at
>

Thanks for the recommendation.
Will take a look at it.
—Ray


-- 
Raymond Cote, President
voice: +1.603.924.6079 email: rgac...@appropriatesolutions.com skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Is it worth to emit more specific (but possible uniform) error messages in 
other unpacking cases (see msg307999)?

FYI if a class implements __iter__ which returns non-iterable, the following 
error is raised:

>>> class C:
... def __iter__(self):
... return 1
... 
>>> a, b = C()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: iter() returned non-iterator of type 'int'

--

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Christian Gollwitzer

Am 18.12.17 um 05:54 schrieb Bill:

Chris Angelico wrote:

I don't know about vtables as needing to be in ANY programming course.
They're part of a "let's dive into the internals of C++" course. You
certainly don't need them to understand how things work in Python,
because they don't exist; and I'm doubtful that you need to explain
them even to C++ programmers.


Then how are you going to explain dynamic_cast?



You don't need to explain a vtable to explain dynamic_cast. Only if you 
want to become a compiler writer. It is not even required, vtables are 
just the most common implementation.


dynamic_cast simply checks if the actual object that the pointer points 
to is an instance of a derived class, and then casts it into that. You 
could "explain" it with the following pseudo-code


template 
T* dynamic_cast(base *input) {
if (isinstanceof(base, *input)) { return (T*)input; }
else { return nullptr; }
}

How that works (particularly the "isinstanceof") is not the business of 
the programmer - it is sufficient to know that the compiler somewhere 
stores this information for every object.


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


Re: [OT] Python and Excel

2017-12-18 Thread oliver
That would be amazing. I still have nightmares of when I had to create this
big options analysis VBA program in Excel 2007.

On Mon, Dec 18, 2017, 14:21 MRAB,  wrote:

> Those who use Excel might find this interesting:
>
> Microsoft Considers Adding Python as an Official Scripting Language to
> Excel
>
> https://www.bleepingcomputer.com/news/microsoft/microsoft-considers-adding-python-as-an-official-scripting-language-to-excel/
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Oliver
My StackOverflow contributions
My CodeProject articles
My Github projects
My SourceForget.net projects
-- 
https://mail.python.org/mailman/listinfo/python-list


__contains__ classmethod?

2017-12-18 Thread Tim Chase
Playing around, I had this (happens to be Py2, but gets the same
result in Py3) code

class X(object):
  ONE = "one"
  TWO = "two"
  _ALL = frozenset(v for k,v in locals().items() if k.isupper())
  @classmethod
  def __contains__(cls, v):
return v in cls._ALL
print(dir(X))
print(X._ALL)

Running this gives

  ['ONE', 'TWO', '_ALL', '__class__', '__contains__', '__delattr__',
  '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__',
  '__getattribute__', '__gt__', '__hash__', '__init__', '__le__',
  '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
  '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
  '__str__', '__subclasshook__', '__weakref__']

And then, depending on whether it's Py2 or Py3, I get either

  frozenset({'one', 'two'})
  frozenset(['two', 'one'])

Which I expect.  Hey, look. There's a __contains__ method. And it
has been specified as a @classmethod.  So I want to test it:

  print("one" in X)

However that fails with

  Traceback (most recent call last):
File "x.py", line 10, in 
  print("one" in X)
  TypeError: argument of type 'type' is not iterable

My understanding was that "in" makes use of an available __contains__
but something seems to preventing Python from finding that.

What's going on here?

Thanks,

-tkc








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


Re: Python Learning

2017-12-18 Thread Rob Gaddi

On 12/18/2017 08:45 AM, Larry Martell wrote:

On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  wrote:

However, one great way to stand out is a portfolio of GitHub projects.
Several people have gotten an offer largely based on those (after they
aced the technical interviews). For example, we just hired someone who
had written a game in sed. That doesn't make him an "interesting
person," nor do we look for game or sed developers. But that silly
exercise deeply resonated with our team. We expect to have great synergy
with him.


I have been excluded from even getting an interview because I did not
have a portfolio of GitHub projects. I think that is a bad filter. I
work 60-70 hours a week for pay, and I have a family and personal
interests.



When I'm hiring I don't necessarily need a candidate to have an 
extensive open-source portfolio, but I need to see some kind of 
portfolio, just as a bar of "This is what I consider my good work to 
be."  The idea that someone is going to have years of experience, but 
not a single page of code that they can let me look over always strikes 
me as odd.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


[issue32259] Misleading "not iterable" Error Message when generator return a "simple" type, and a tuple is expected

2017-12-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In English, 'adjective noun' does not necessarily imply the existence of 
'not-adjective' nouns, and the adjective may serve as a reminder or reason.  
For instance, "This job is too dangerous for mortal humans!"

In the current context, failure of 'iter(ob)', by itself, only tells us that 
the particular object ob is not iterable. "'X' object is not iterable", rather 
that "'X' objects are not iterable", is correct.  (Ditto for other messages.)

That said, I think "cannot unpack int object, because not iterable" is better.

--

___
Python tracker 

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



[issue32278] Allow dataclasses.make_dataclass() to omit type information

2017-12-18 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm going to use "typing.Any" (as a string) if the type information is omitted 
in the call to make_dataclass(). That way I don't need to import typing.

--

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Marko Rauhamaa
Rhodri James :

> On 18/12/17 16:33, Marko Rauhamaa wrote:
>> Rhodri James :
>>> Exactly what "interesting" meant was somewhat arbitrary; we put one
>>> person through to interview because she was a cellist, and that
>>> would have given us a complete string quartet (she didn't get the
>>> job, sadly).
>>
>> We want to hire for the job and not bring in extracurricular
>> activities.
>>
>> However, one great way to stand out is a portfolio of GitHub
>> projects.
>
> Er, isn't that an extracurricular activity? I certainly don't have
> time for it outside work.

GitHub projects are directly applicable to our line of business. Music
is not.


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


[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Gregory P. Smith

Gregory P. Smith  added the comment:


New changeset 2d8f06382e7d5a759ca554110a699a397114824a by Gregory P. Smith 
(izbyshev) in branch 'master':
bpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)
https://github.com/python/cpython/commit/2d8f06382e7d5a759ca554110a699a397114824a


--

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
nosy: +gregory.p.smith, pitrou

___
Python tracker 

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



[issue32369] test_subprocess: last part of test_close_fds() doesn't check what's intended

2017-12-18 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

The last part of test_close_fds() doesn't match its own comment. The following 
assertion always holds because fds_to_keep and open_fds are disjoint by 
construction.

self.assertFalse(remaining_fds & fds_to_keep & open_fds,
 "Some fds not in pass_fds were left open")

--
components: Tests
messages: 308581
nosy: izbyshev
priority: normal
severity: normal
status: open
title: test_subprocess: last part of test_close_fds() doesn't check what's 
intended
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



[OT] Python and Excel

2017-12-18 Thread MRAB

Those who use Excel might find this interesting:

Microsoft Considers Adding Python as an Official Scripting Language to Excel
https://www.bleepingcomputer.com/news/microsoft/microsoft-considers-adding-python-as-an-official-scripting-language-to-excel/
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-18 Thread Gene Heskett
On Monday 18 December 2017 09:19:01 Chris Angelico wrote:

> On Tue, Dec 19, 2017 at 1:09 AM, Rhodri James  
wrote:
> > On 18/12/17 13:28, Marko Rauhamaa wrote:
> >> However, I have been doing quite a bit of hiring, quite
> >> successfully, I might add. I am not prejudiced one way or another.
> >> Your résumé doesn't count. Your education doesn't count. What you
> >> can do for the team counts, and that is measured during the
> >> interview process.
> >
> > While I agree with most of what you say, I disagree with you here. 
> > Your CV (résumé) does count, just not necessarily in the way most
> > people expect.
> >
> > I haven't often been involved in hiring, but the few times I have we
> > had more applicants than it was feasible to interview.  We used CVs
> > as the only thing we had to filter with, looking for *interesting*
> > people.
>
> This is NORMALLY going to be the case. How many hours does it take to
> truly evaluate a candidate? You can't afford to interview a hundred
> people only to find that ninety of them are hopelessly unqualified.
> Somehow, you have to sift out the most likely candidates, and THEN you
> actually meet with them.
>
> But Marko is partly right too. Your CV/résumé isn't going to land you
> the job, nor is your education. But they might land you the interview.
> With the students I work with, there's a dedicated Careers Services
> team that help them to polish their portfolio projects, because a
> portfolio is *way* more indicative than a CV or a college degree; but
> even then, the best portfolio in the world is only good enough to get
> you as far as an interview.
>
> > Exactly what
> > "interesting" meant was somewhat arbitrary; we put one person
> > through to interview because she was a cellist, and that would have
> > given us a complete string quartet (she didn't get the job, sadly).
>
> Heh. Pity. That would be fun.
>
> ChrisA

I'll have to agree with most of this about "interesting" people.

But one thing I always  note from the resume or CV is any certifications 
they may carry. I am a C.E.T., and that card laid in front of an HR/GM 
type has gotten me every job I've applied for since 1972, but sadly 
those are rare birds indeed as I've not in the 45 years since, 
encountered another such individual. So I've had to depend on their 
familiarity with a soldering iron and some scope probes to determine if 
they would be useful to me.

That certification is required to get a business license for an 
electronics service business in Kalipornia, weeds out the fly by 
nighters there was a plague of back in the 60's _& 70's.

There really ought to be a similar program for coders. I'd probably fail 
that one, but generally my code works, and does not crash. And I've 
learned a lot while fixing it if it does crash. :)

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2017-12-18 Thread R. David Murray

R. David Murray  added the comment:

What is happening here is that what nonlocal does is give the function 
containing the nonlocal statement access to the "cell" in the parent function 
that holds the local variable of that function.  When you use a global 
statement, the name instead refers to a global variable, and  there is no local 
cell created for that variable name.  Thus you get "no binding [cell] for 
nonlocal 'a' found".  That is literally correct from the compiler's point of 
view.

I agree that this message is mysterious unless you understand how python 
scoping works at a fairly detailed level, and thus it would be nice if the 
error message could be improved.  The code generating the message may not know 
that there's a global statement for that name in effect, though, so it might 
not be trivial to improve it.

Would it be possible for nonlocal to effectively "chain", and turn the 
references in the inner function into global references?  In theory the answer 
would be yes, but in practice it might be distinctly non-trivial, and would 
probably be a PEP level change to the language.  It is currently documented 
that nonlocal does not look in to the global namespace 
(https://docs.python.org/3/reference/simple_stmts.html#nonlocal): "The nonlocal 
statement causes the listed identifiers to refer to previously bound variables 
in the nearest enclosing scope excluding globals.)

--

___
Python tracker 

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



[issue32363] Deprecate task.set_result() and task.set_exception()

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

+1.

--

___
Python tracker 

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



[issue32364] Add AbstractFuture and AbstractTask

2017-12-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

+1, let's do it.  I'd add a new module - 'asyncio.abc' and put them both there 
(as well as asyncio.isfuture() function).

--

___
Python tracker 

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



Re: Recommended pypi caching proxy?

2017-12-18 Thread Matt Wheeler
On Mon, 18 Dec 2017, 15:45 Ray Cote, 
wrote:

> Looking to deploy a locally cached pypi proxy service.
>
> Is there a recommended/preferred pypi caching tool?
> I’ve found:
>   - proxypypy
>   - Flask-Pypi-Proxy
>   - pypicache
>
> All of which seem to have generally the same functionality and all of which
> are a few years old.
> Recommendations from the crowd?
>

In the past I've used https://github.com/devpi/devpi
It may have many features you don't need if all you're after is a caching
proxy, but I found it does that well and it appears to still be pretty
active.

> --

--
Matt Wheeler
http://funkyh.at
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-18 Thread Rhodri James

On 18/12/17 16:33, Marko Rauhamaa wrote:

Rhodri James :

I haven't often been involved in hiring, but the few times I have we
had more applicants than it was feasible to interview.


You don't have to interview them all. Once you encounter an excellent
candidate, you can close the deal. If you don't, you might lose them.
You don't have to find the one pearl in a thousand.


We used CVs as the only thing we had to filter with, looking for
*interesting* people.


For a developer position, we use a home assignment as a filter. There's
no knowing who completes the assignment, but (1) it gives an idea what
is expected of them and (2) it demonstrates interest from their part.


I believe we have a standard set of C programming questions we throw at 
interviewees, on the same principle.


One place I worked at used to request a hand-written cover letter with 
applications.  This too was a filter, though not by graphological 
analysis as many people assumed (and took umbrage at).  No, we were 
testing if you could follow instructions and take some degree of care. 
A hastily scribbled piece of paper with lots of crossings out didn't 
auger well for how careful you would be with the code base!



Exactly what "interesting" meant was somewhat arbitrary; we put one
person through to interview because she was a cellist, and that would
have given us a complete string quartet (she didn't get the job,
sadly).


We want to hire for the job and not bring in extracurricular activities.

However, one great way to stand out is a portfolio of GitHub projects.


Er, isn't that an extracurricular activity?  I certainly don't have time 
for it outside work.



Several people have gotten an offer largely based on those (after they
aced the technical interviews). For example, we just hired someone who
had written a game in sed. That doesn't make him an "interesting
person," nor do we look for game or sed developers. But that silly
exercise deeply resonated with our team. We expect to have great synergy
with him.


In other words, you find him interesting because of that.

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


[issue32357] Optimize asyncio.iscoroutine() and loop.create_task() for non-native coroutines

2017-12-18 Thread Yury Selivanov

Change by Yury Selivanov :


Added file: https://bugs.python.org/file47337/bench.py

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 12:05 PM, Chris Angelico  wrote:
> On Tue, Dec 19, 2017 at 3:45 AM, Larry Martell  
> wrote:
>> On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  wrote:
>>> However, one great way to stand out is a portfolio of GitHub projects.
>>> Several people have gotten an offer largely based on those (after they
>>> aced the technical interviews). For example, we just hired someone who
>>> had written a game in sed. That doesn't make him an "interesting
>>> person," nor do we look for game or sed developers. But that silly
>>> exercise deeply resonated with our team. We expect to have great synergy
>>> with him.
>>
>> I have been excluded from even getting an interview because I did not
>> have a portfolio of GitHub projects. I think that is a bad filter. I
>> work 60-70 hours a week for pay, and I have a family and personal
>> interests.
>
> Maybe not GitHub, but something else. Do you have, anywhere on the
> internet, a list of demo-worthy projects? Again drawing from the
> students I work with, they're encouraged to build an actual portfolio
> web site. Granted, they *are* full stack web developers, so this may
> not be applicable to everyone, but still, it's independent of GitHub.

Nothing I can put on the internet because the work I have done is
either an embedded system or proprietary and used in house for a
company, or part of a commercial project. I do have things I can show
from my machine using my development environment, and I have offered
that up, but for those who want to see something on GitHub it does not
get that far.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Learning

2017-12-18 Thread Chris Angelico
On Tue, Dec 19, 2017 at 3:45 AM, Larry Martell  wrote:
> On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  wrote:
>> However, one great way to stand out is a portfolio of GitHub projects.
>> Several people have gotten an offer largely based on those (after they
>> aced the technical interviews). For example, we just hired someone who
>> had written a game in sed. That doesn't make him an "interesting
>> person," nor do we look for game or sed developers. But that silly
>> exercise deeply resonated with our team. We expect to have great synergy
>> with him.
>
> I have been excluded from even getting an interview because I did not
> have a portfolio of GitHub projects. I think that is a bad filter. I
> work 60-70 hours a week for pay, and I have a family and personal
> interests.

Maybe not GitHub, but something else. Do you have, anywhere on the
internet, a list of demo-worthy projects? Again drawing from the
students I work with, they're encouraged to build an actual portfolio
web site. Granted, they *are* full stack web developers, so this may
not be applicable to everyone, but still, it's independent of GitHub.

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


[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

I think so, too.

--

___
Python tracker 

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



[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread Charalampos Stratakis

Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Duplicate of issue31113?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Larry Martell
On Mon, Dec 18, 2017 at 11:33 AM, Marko Rauhamaa  wrote:
> However, one great way to stand out is a portfolio of GitHub projects.
> Several people have gotten an offer largely based on those (after they
> aced the technical interviews). For example, we just hired someone who
> had written a game in sed. That doesn't make him an "interesting
> person," nor do we look for game or sed developers. But that silly
> exercise deeply resonated with our team. We expect to have great synergy
> with him.

I have been excluded from even getting an interview because I did not
have a portfolio of GitHub projects. I think that is a bad filter. I
work 60-70 hours a week for pay, and I have a family and personal
interests.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Christian Heimes

Christian Heimes  added the comment:

Looks like 174,565 stack frames are a bit too much :)

(gdb) bt
#0  dfs (c=0x7fffcbe0, b=0x7fffea076d60, a=0x7fffcb50) at 
Python/compile.c:4903
#1  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076db0, 
a=0x7fffcb50) at Python/compile.c:4903
#2  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076cc0, 
a=0x7fffcb50) at Python/compile.c:4903
#3  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076d10, 
a=0x7fffcb50) at Python/compile.c:4903
#4  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076c20, 
a=0x7fffcb50) at Python/compile.c:4903
#5  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076c70, 
a=0x7fffcb50) at Python/compile.c:4903
#6  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076b80, 
a=0x7fffcb50) at Python/compile.c:4903
#7  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076bd0, 
a=0x7fffcb50) at Python/compile.c:4903
#8  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076ae0, 
a=0x7fffcb50) at Python/compile.c:4903
#9  0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076b30, 
a=0x7fffcb50) at Python/compile.c:4903
#10 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076a40, 
a=0x7fffcb50) at Python/compile.c:4903
#11 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076a90, 
a=0x7fffcb50) at Python/compile.c:4903
#12 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea0769a0, 
a=0x7fffcb50) at Python/compile.c:4903
#13 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea0769f0, 
a=0x7fffcb50) at Python/compile.c:4903
#14 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x7fffea076900, 
a=0x7fffcb50) at Python/compile.c:4903

(gdb) bt -50
...
#174562 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x704609a0, 
a=0x7fffcb50) at Python/compile.c:4903
#174563 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x704609f0, 
a=0x7fffcb50) at Python/compile.c:4903
#174564 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x70460900, 
a=0x7fffcb50) at Python/compile.c:4903
#174565 0x004e47a2 in dfs (c=0x7fffcbe0, b=0x70460950, 
a=0x7fffcb50) at Python/compile.c:4903
#174566 0x004e47a2 in dfs (c=c@entry=0x7fffcbe0, 
b=b@entry=0x704608b0, a=a@entry=0x7fffcb50) at Python/compile.c:4903
#174567 0x004e9844 in assemble (c=c@entry=0x7fffcbe0, 
addNone=) at Python/compile.c:5411
#174568 0x004ed809 in compiler_mod (c=c@entry=0x7fffcbe0, 
mod=mod@entry=0x3523788) at Python/compile.c:1494
#174569 0x004eda33 in PyAST_CompileObject (mod=0x3523788, 
filename=filename@entry='foobar', flags=flags@entry=0x7fffccb4, 
optimize=optimize@entry=-1, arena=arena@entry=0x70466f40)
at Python/compile.c:345
#174570 0x0050fcaa in Py_CompileStringObject (
str=0x7fffef9d1070 "42 if True else 43\n42 if True else 43\n42 if True else 
43\n42 if True else 43\n42 if True else 43\n42 if True else 43\n42 if True else 
43\n42 if True else 43\n42 if True else 43\n42 if True else 43\n42 if True"..., 
filename=filename@entry='foobar', start=start@entry=257, 
flags=flags@entry=0x7fffccb4, optimize=optimize@entry=-1) at 
Python/pythonrun.c:1098
#174571 0x004d2146 in builtin_compile_impl (module=module@entry=,

--
nosy: +christian.heimes

___
Python tracker 

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



Re: Python Learning

2017-12-18 Thread Marko Rauhamaa
Rhodri James :
> I haven't often been involved in hiring, but the few times I have we
> had more applicants than it was feasible to interview.

You don't have to interview them all. Once you encounter an excellent
candidate, you can close the deal. If you don't, you might lose them.
You don't have to find the one pearl in a thousand.

> We used CVs as the only thing we had to filter with, looking for
> *interesting* people.

For a developer position, we use a home assignment as a filter. There's
no knowing who completes the assignment, but (1) it gives an idea what
is expected of them and (2) it demonstrates interest from their part.

I only take a look at the CV when I arrive at the interview so I have
talking points with the candidate.

> Exactly what "interesting" meant was somewhat arbitrary; we put one
> person through to interview because she was a cellist, and that would
> have given us a complete string quartet (she didn't get the job,
> sadly).

We want to hire for the job and not bring in extracurricular activities.

However, one great way to stand out is a portfolio of GitHub projects.
Several people have gotten an offer largely based on those (after they
aced the technical interviews). For example, we just hired someone who
had written a game in sed. That doesn't make him an "interesting
person," nor do we look for game or sed developers. But that silly
exercise deeply resonated with our team. We expect to have great synergy
with him.


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


[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Red Hat: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-17522
Ubuntu: 
https://people.canonical.com/~ubuntu-security/cve/2017/CVE-2017-17522.html
SUSE: https://bugzilla.novell.com/show_bug.cgi?id=CVE-2017-17522

--

___
Python tracker 

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



[issue32368] Segfault when compiling many conditional expressions

2017-12-18 Thread Stefan Nordhausen

New submission from Stefan Nordhausen :

The following code reproducibly segfaults in version 2.7.13, 3.6.3 and the 
current git master (3.7.0a3+):


code = "42 if True else 43\n" * 20
compile(code, "foobar", "exec")


This issue was originally found because the Jinja templating engine internally 
produces large tuples with many conditional expressions, thus triggering this 
bug (see https://github.com/pallets/jinja/issues/784 ).

--
components: Interpreter Core
messages: 308573
nosy: snordhausen
priority: normal
severity: normal
status: open
title: Segfault when compiling many conditional expressions
type: crash
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue32367] [Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

Change by STINNER Victor :


--
title: CVE-2017-17522: webbrowser.py in Python does not validate strings -> 
[Security] CVE-2017-17522: webbrowser.py in Python does not validate strings

___
Python tracker 

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



[issue32367] CVE-2017-17522: webbrowser.py in Python does not validate strings

2017-12-18 Thread STINNER Victor

New submission from STINNER Victor :

https://security-tracker.debian.org/tracker/CVE-2017-17522

Lib/webbrowser.py in Python through 3.6.3 does not validate strings before 
launching the program specified by the BROWSER environment variable, which 
might allow remote attackers to conduct argument-injection attacks via a 
crafted URL.

--
components: Library (Lib)
messages: 308572
nosy: vstinner
priority: normal
severity: normal
status: open
title: CVE-2017-17522: webbrowser.py in Python does not validate strings
type: security
versions: Python 2.7, Python 3.4, Python 3.5, 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



[issue32236] open() shouldn't silently ignore buffering=1 in binary mode

2017-12-18 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

I had similar thoughts when I was fixing tests that broke due to ValueError. 
I've updated the PR to issue a RuntimeWarning instead.

--

___
Python tracker 

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



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

2017-12-18 Thread Camion

Camion  added the comment:

I forgot to mention, that I wonder if the interpreter shouldn't instead,
- either consider that since global a is used is g, it should be considered as 
also local to g from h point of view,
- or if h should be able to access f's version of a.
- (or if on the contrary, this ambiguity is the very reason to cause a syntax 
error, -- but in this case, one might need to change the text of the error 
message to make it more accurate. --)

--

___
Python tracker 

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



Recommended pypi caching proxy?

2017-12-18 Thread Ray Cote
Hello list:

Looking to deploy a locally cached pypi proxy service.

Is there a recommended/preferred pypi caching tool?
I’ve found:
  - proxypypy
  - Flask-Pypi-Proxy
  - pypicache

All of which seem to have generally the same functionality and all of which
are a few years old.
Recommendations from the crowd?
—Ray


-- 
Raymond Cote, President
Tokenize What Matters®
voice: +1.603.924.6079 email: rgac...@appropriatesolutions.com skype:
ray.cote
Schedule a meeting: https://calendly.com/ray_cote/60min/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem with timeit

2017-12-18 Thread ast


"Steve D'Aprano"  a écrit dans le message de 
news:5a33d0fc$0$2087$b1db1813$d948b...@news.astraweb.com...

On Sat, 16 Dec 2017 12:25 am, ast wrote:



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

On 2017-12-15 11:36, ast wrote:








py> x = 123456**123456
py> s = str(x)
py> len(s)
628578




I discovered that log functions from math module
works with integers, whatever their size, there is
no conversion to float.


import math
x = 123456**123456
math.log10(x)

628577.7303641582   (instantaneous)

so 628578 digits


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


[issue15873] datetime: add ability to parse RFC 3339 dates and times

2017-12-18 Thread Paul Ganssle

Paul Ganssle  added the comment:

> Not if the time is associated with a particular day. Imagine implementing 
> datetime.fromisoformat by separately calling date.fromisoformat and 
> time.fromisoformat. The date will be off by one day if you naively rounded 
> 2017-12-18 23:59 “up” to 2017-12-18 00:00.

Yes, I suppose this is a problem if you implement it that way. Seems like a 
somewhat moot point, but I think any decision about rounding should probably be 
driven by what people are expecting more than by how it is implemented.

That said, I can see a good case for truncation *and* rounding up for something 
like '2016-12-31T23:59:59.9'. Rounding up to '2017-01-01' is certainly 
the closest whole millisecond to round to, *but* often people expressing a 
"23:59:59.999" are trying to actually express "the last possible moment 
*before* 00:00".

--

___
Python tracker 

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



[issue20329] zipfile.extractall fails in Posix shell with utf-8 filename

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> I don't think that we can fix this bug, sadly. But I'm happy to see that the 
> PEP 538 and PEP 540 are already useful!

Oops, I mean "we cannot *close* this bug" (right now). Sorry.

I mean that IMHO we still have to fix the bug.

--

___
Python tracker 

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



[issue19846] Python 3 raises Unicode errors with the C locale

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue22016] Add a new 'surrogatereplace' output only error handler

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--
nosy: +vstinner

___
Python tracker 

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



[issue21368] Check for systemd locale on startup if current locale is set to POSIX

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7!

--

___
Python tracker 

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



[issue29042] os.path.exists should not throw "Embedded NUL character" exception

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

> A path containing an embedded NUL character simply cannot name an existing 
> file, and therefore os.path.exists should return False for such a path.

I disagree. Python doesn't call the syscall and so must raise a different 
exception.

You must not pass a path with embedded NULL character/byte. That's all.

Write your own wrapper to os.path.exists() if you want to a different behaviour.

--
nosy: +vstinner
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



[issue19847] Setting the default filesystem-encoding

2017-12-18 Thread STINNER Victor

STINNER Victor  added the comment:

Follow-up: the PEP 538 (bpo-28180) and PEP 540 (bpo-29240) have been accepted 
and implemented in Python 3.7. Python 3.7 will now use UTF-8 by default for the 
POSIX locale, and the encoding can be forced to UTF-8 using -X utf8 option.

--

___
Python tracker 

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



  1   2   >