[issue33033] Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking

2018-03-08 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This doesn't look a good idea to me. It is implied that all checks are 
performed. For example it is implied that an error will be raised if the 
argument is of wrong type. I think that adding "with overflow checking" to 
every converting from a Python integer will just clutter the documentation.

--
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: Unnoticed traceback in a thread

2018-03-08 Thread dieter
Skip Montanaro  writes:

> I have a program which is almost always running in a single thread. It
> uses a daemon thread (via threading.Timer) to periodically checkpoint
> some state. The program runs for days at a time.
>
> Over the past couple days, two instances of the subthread croaked with
> tracebacks because while they were iterating over the checkpointable
> data, the main thread modified the data. Blammo! It was an easy fix
> (threading.Lock) and everything is back on an even keel.
>
> After the bug was tickled, the program continued to do its thing. It
> just stopped checkpointing. Given the way the program is managed, the
> traceback wound up in an obscure log file, and it was a couple days
> before I noticed it. I've seen this sort of
> thread-dies-but-program-doesn't-crash situation before. I can look at
> ways to more actively monitor the contents of the obscure log file,
> but is there some non-hackish way that the demise of the daemon thread
> can take down the entire program? (Sometimes it's good that it doesn't
> crash. Other times it would at least be handy if it did.)

I approach situations like this by running the thread function
inside a "try: ... except: ..." block. In the "except" handler,
I can then so whatever is necessary if the thread function has died
unexpectedly -- e.g. kill the complete process.

Concretely: instead of "start_new_thread(my_thread_function, ...)",
I use

def wrapped_thread_function(*args, **kw):
  try:
my_thread_function(*args, **kw)
  except:
... do whatever is necessary should "my_thread_function" fails ...

start_new_thread(wrapped_thread_function, ...)

Similar, should you use the "Thread" class (instead of "start_new_thread").

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


Re: socket: Did I find a bug?

2018-03-08 Thread dieter
Antoon Pardon  writes:
> This is on a debian 9 box python 2.7.13
>
> My interpretation is that a timeout exception is thrown and that the
> args attribute of such an exception is an empty tuple which then causes
> an IndexError in line 482 of module /usr/lib/python2.7/socket.py. Does
> that soundplausible?

Yes -- however, usually the "args" tuple of an exception is not empty.

I am using the FTP class in Python 2.7 myself and I am quite
(though not completely) sure that I already have had timeouts in
my FTP interaction -- without seeing your problem.

Nevertheless, you might see a bug: there are two kinds of timeouts:
connection and read timeout. You are facing a read timeout (if
you see a timeout at all); while I likely saw connection timeouts.
However, the resulting timeout exception should in both cases
be identical with respect to the "args" tuple.

> Here is the traceback:
>
> Traceback (most recent call last):
> ...
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 211, in open
> return ftpfile(ftp, fn, mode, True)
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 70, in __init__
> self.cnct =  self.ftp.transfercmd("%s %s" % (cmd, rfn))
>   File "/usr/lib/python2.7/ftplib.py", line 376, in transfercmd
> return self.ntransfercmd(cmd, rest)[0]
>   File "/usr/lib/python2.7/ftplib.py", line 710, in ntransfercmd
> conn, size = FTP.ntransfercmd(self, cmd, rest)
>   File "/usr/lib/python2.7/ftplib.py", line 339, in ntransfercmd
> resp = self.sendcmd(cmd)
>   File "/usr/lib/python2.7/ftplib.py", line 249, in sendcmd
> return self.getresp()
>   File "/usr/lib/python2.7/ftplib.py", line 215, in getresp
> resp = self.getmultiline()
>   File "/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
> line = self.getline()
>   File "/usr/lib/python2.7/ftplib.py", line 186, in getline
> line = self.file.readline(self.maxline + 1)
>   File "/usr/lib/python2.7/socket.py", line 482, in readline
> if e.args[0] == EINTR:
> IndexError: tuple index out of range

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


Re: Module Issue

2018-03-08 Thread dieter
Abdur-Rahmaan Janhangeer  writes:
> i have a project at
>
> https://github.com/Abdur-rahmaanJ/honeybot
>
> see https://github.com/Abdur-rahmaanJ/honeybot/tree/master/honeybot
>
> my question is :
>
> how to include a util file / module that can be imported in both
> core_plugins and
> user_plugins?
>
> if that is too difficult, let us take only core_plugins
>
> make a module not found error not appear when running main.py

Have a look at so called "namespace package"s.

A "namespace package" is in some sense a "virtual package" consisting
of an extensible set of subpackages (real and
potentially other "namespace" packages).
The subpackages may declare dependencies on other subpackages
of the "namespace package" and thereby ensure, that the subset
they depend on are installed if they are installed.


"dm.zope.rpc" is an example for such a "namespace package".
It contains common (= cross protocol) RPC (= "Remote Procedure Call")
infrastructure (and some protocol plugins);
"dm.zope.rpc.wsdl_suds" is a subpackage providing support
for the SOAP/WSDL protocol (using "suds" as basic implementation
component).

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


[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-08 Thread Nathan Henrie

Nathan Henrie  added the comment:

It seems to work if you close proto.transport (as is done in 
`test_write_pty()`).

--

___
Python tracker 

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



[issue32517] test_read_pty_output() of test_asyncio hangs on macOS 10.13.2 (darwin 17.3.0)

2018-03-08 Thread Nathan Henrie

Change by Nathan Henrie :


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



Re: I found strange thing while studying through idle

2018-03-08 Thread Ben Finney
MRAB  writes:

> I think the line was actually […]
> (I also think that "crystal" is […]

Let's not get into the warrens of responding to what the OP *didn't*
write. we're in no hurry. I'd like to wait for clarification from the
original poster, and not guess what they meant.

-- 
 \   “The Vatican is not a state.… a state must have people. There |
  `\are no Vaticanians.… No-one gets born in the Vatican except by |
_o__)an unfortunate accident.” —Geoffrey Robertson, 2010-09-18 |
Ben Finney

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


Re: Which part of the loop is it going through in this class frame?

2018-03-08 Thread Steven D'Aprano
On Thu, 08 Mar 2018 20:25:42 -0500, C W wrote:

> Thank you guys, lots of great answers, very helpful. I got it!
> 
> A follow-up question:
> 
> How did the value of "object" get passed to "time"? Obviously, they have
> different names. How did Python make that connection?

It didn't. You have misunderstood what is happening. Let's go though it 
bit by bit:

> Code is below for convenience.
> 
> class Clock(object):

The "class" statement declares a new class, called "Clock", which 
inherits from the built-in class "object".

[Aside: some people describe "object" as a "type" rather than a class. 
There are some differences in meaning between type/class in computer 
science, and in Python 2 they are slightly different things, but in 
Python 3 you can consider class and type to be synonyms.]

So object is not a parameter, it is a superclass. This tells Python that 
your Clock class is a subclass of object.

> def __init__(self, time):
> self.time = time

The initialiser __init__ method is special, because it defines the 
signature for calling the class. So when you say:

clock = Clock("5:30")


Python creates a new Clock instance, and calls __init__ and passes "5:30" 
as the *time* parameter.

(I have glossed over some technical details and complexities.)

The thing to remember is that when you create a new instance by calling 
the class Clock(...), your arguments have to match the __init__ method.


-- 
Steve

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


Re: Spot the invalid syntax

2018-03-08 Thread Steven D'Aprano
On Fri, 09 Mar 2018 00:47:21 +, MRAB wrote:

> On 2018-03-08 23:57, Ben Finney wrote:

>> You mean the tool is not always looking for mistakes while you type?
[...]
>> Certainly it'd be good to always have a *perfect* overseer checking for
>> mistakes . Until that happy day, though, let's use the tools available
>> to improve our code before even attempting to run it.
>> 
> "... while one types"? I'm not so sure.
> 
> In the past I've used an IDE (not for Python) that, for example,
> underlined any identifiers that hadn't been defined, but found it
> annoying because it was indicating errors that were due to my not having
> finished writing yet!

Aye, I find that error-checking while you type is a PITA. I tried using 
the Spyder IDE for a week or so, it was just so painful to use I couldn't 
keep going.

I'm not the world's fastest typest, so the fact that Spyder couldn't keep 
up with me was a serious black mark against it. There was visible lag 
between me typing and the characters showing up in the editor: I could 
type something like "for x in" before the "f" would appear.

Errors were highlighted in (I think?) red, and by displaying an icon next 
to the offending line. So as I would type, the screen would be constantly 
updated, slowly:

# me trying to type "print(mylist)"

p

pr # highlight in red and show the error icon

pri # highlight in red and show the error icon

prin  # highlight in red and show the error icon

print  # remove the highlighting and icon

print(  # display an error icon for missing parenthesis

print()  # okay, I'll type the paren first to keep the checker silent

print(m)

print(my)  # highlight the my in red and show the error icon

[skip a few more keystrokes]
print(mylist)  # finally remove the error highlighting


And because of the lag, it took about 15-20 seconds for the screen to 
update what took me 4-6 seconds to type.

This experience was so painful and unpleasant that it has permanently 
turned me off Spyder. I'd rather use Windows 95 Notepad.

 
> Type, pause for thought, syntax error... yes, I know it's a syntax error
> at the moment, but I'm not finished!

Not even "pause for thought".

I can *maybe* see the sense in checking each physical line once it is 
completed, but that's it. Or at least don't check words for mispellings 
until you have completed the token and started a new token, like your 
spell checker probably does. (The spell checker in this editor doesn't 
check for spelling errors until I hit the spacebar or Enter key, or use 
punctuation.)


-- 
Steve

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


Re: I found strange thing while studying through idle

2018-03-08 Thread MRAB

On 2018-03-09 03:57, Steven D'Aprano wrote:
[snip]


In IDLE 3.5 on Linux, I get this:


print('hello\rpython')

hello\rpython

Curiously, that's not a backslash r, it's actually a carriage return:
when I copy and paste it in this text, the editor treated it as a new
line character:

# direct copy and paste becomes this in my editor

print('hello\rpython')

hello
python


But it is possible that due to differences between platforms, the OP's
version of IDLE doesn't display a carriage return as \r but rather as an
invisible zero-width space.


IDLE 3.6 on Windows, it looks like this:

hellopython

but when I copy and paste it into an editor I get:

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


Re: I found strange thing while studying through idle

2018-03-08 Thread MRAB

On 2018-03-09 01:59, Ben Finney wrote:

Welcome, and congratulations on beginning with Python.

노연수 writes:


If you type print (" hello\ rpython ") into the python 3.7.0.b2


I am not using Python 3.7 (it isn't released yet); I recommend staying
with the latest Python release. Today, that is version 3.6.

That difference in version should not make a difference to the ‘print’
behaviour, so I will assume your code behaves the same in Python 3.6.

When I use Python 3.6 and run the code example you give, it behaves this
way::

 >>> print (" hello\ rpython ")
  hello\ rpython


only the python is printed and i learned it's a crystal.


(I don't understand that last clause; what crystal?)

The output above is what I expect. What do you expect?


However, if you type print (" hello\ rpython ") in the python 3.7.0.b2
idle, it is output as hellopython.


That's not what I see; the output in Idle version 3.6 is exactly the
same::

 >>> print (" hello\ rpython ")
  hello\ rpython


I wonder why it prints like this.


So do I.

Please take the time to cut and paste *exactly* what program code is
being run, and *exactly* what text output you see.

Don't attempt to re-type it manually, because often that makes it
different in detail. One of the tricky things to learn in programming is
that small details can make a big difference!


I have attached the file so I would appreciate your reference.


File attachments are unlikely to survive to most readers of this forum
(they get dropped, to reduce traffic size and spam and dangerous
attachments).

Instead, keep the program code short and simple; then, copy and paste it
exactly into the text body of your message. That's much more likely to
let us see exactly what you're seeing.


I think the line was actually:

print (" hello\rpython ")

and the question is why you get:

python

in a command prompt window, but:

hellopython

in IDLE.

(I also think that "crystal" is a translation error! Is it meant to be 
"control code"?)

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


Re: I found strange thing while studying through idle

2018-03-08 Thread Steven D'Aprano
I'm afraid the original post by 노연수 has not come 
through to me, so I will have to reply to Ben's reply.


On Fri, 09 Mar 2018 12:59:52 +1100, Ben Finney wrote:

> I am not using Python 3.7 (it isn't released yet); I recommend staying
> with the latest Python release. Today, that is version 3.6.

3.6 is the latest *stable* release; but there are unstable releases, such 
as 3.7.0.b2.

We should be glad that there are people willing to run unstable and beta 
versions, otherwise they would not get any real-world testing, bugs would 
not be fixed, and the "stable" X.Y.0 release would be a de-facto 
unstable, untried beta version.


> When I use Python 3.6 and run the code example you give, it behaves this
> way::
> 
> >>> print (" hello\ rpython ")
>  hello\ rpython

My guess is that the Original Poster carelessly re-typed his code instead 
of copying and pasting it. When he said he tried this:

print (" hello\ rpython ")

what he *actually* did was probably something like this:

print ("hello\rpython")

When I try that, I get this:

py> print ("hello \rpython")
python


which seems to match the OP's description.

Printing strings containing \r (carriage returns) may be dependent on the 
console or terminal you use, and even on *where* the carriage return is 
in the string, but in general I expect that printing \r will instruct the 
terminal to return to the beginning of the CURRENT line. The rest of the 
string will then overwrite the beginning of the line. For example:

py> print ("hello world\rpython")
pythonworld


>> However, if you type print (" hello\ rpython ") in the python 3.7.0.b2
>> idle, it is output as hellopython.

Again, my prediction is that the OP has carelessly retyped his code, and 
what he means is 

print ("hello \rpython")

which in IDLE *does not* return to the start of the line. 

In IDLE 3.5 on Linux, I get this:

>>> print('hello\rpython')
hello\rpython

Curiously, that's not a backslash r, it's actually a carriage return: 
when I copy and paste it in this text, the editor treated it as a new 
line character:

# direct copy and paste becomes this in my editor
>>> print('hello\rpython')
hello
python


But it is possible that due to differences between platforms, the OP's 
version of IDLE doesn't display a carriage return as \r but rather as an 
invisible zero-width space.



-- 
Steve

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


[issue28626] Tutorial: rearrange discussion of output formatting to encourage f-strings

2018-03-08 Thread A.M. Kuchling

Change by A.M. Kuchling :


--
pull_requests: +5798

___
Python tracker 

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



Re: Futurize maps StringIO.StringIO to io.StringIO

2018-03-08 Thread Skip Montanaro
Thanks. In one instance I used six.StringIO, which seems to work. The
question I had was more why futurize makes a transformation which is an
obvious semantic change.

Skip

On Thu, Mar 8, 2018, 7:55 PM Mark Lawrence  wrote:

> On 08/03/18 02:34, Skip Montanaro wrote:
> > I had some deja vu recently, cuz of this old thread:
> >
> > https://mail.python.org/pipermail/python-list/2013-May/648245.html
> >
> > Today the context is different, but the problem remains the same. One
> > of the futurize refactoring tools converts usage of StringIO.StringIO
> > to io.StringIO, which, given that the latter accepts just about
> > anything you through at it, is a bit surprising. Perhaps there is no
> > true corresponding class in the io module?
> >
> > Skip
> >
>
> Maybe you need io.BytesIO?
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I found strange thing while studying through idle

2018-03-08 Thread Ben Finney
Welcome, and congratulations on beginning with Python.

노연수 writes:

> If you type print (" hello\ rpython ") into the python 3.7.0.b2

I am not using Python 3.7 (it isn't released yet); I recommend staying
with the latest Python release. Today, that is version 3.6.

That difference in version should not make a difference to the ‘print’
behaviour, so I will assume your code behaves the same in Python 3.6.

When I use Python 3.6 and run the code example you give, it behaves this
way::

>>> print (" hello\ rpython ")
 hello\ rpython 

> only the python is printed and i learned it's a crystal.

(I don't understand that last clause; what crystal?)

The output above is what I expect. What do you expect?

> However, if you type print (" hello\ rpython ") in the python 3.7.0.b2
> idle, it is output as hellopython.

That's not what I see; the output in Idle version 3.6 is exactly the
same::

>>> print (" hello\ rpython ")
 hello\ rpython 

> I wonder why it prints like this.

So do I.

Please take the time to cut and paste *exactly* what program code is
being run, and *exactly* what text output you see.

Don't attempt to re-type it manually, because often that makes it
different in detail. One of the tricky things to learn in programming is
that small details can make a big difference!

> I have attached the file so I would appreciate your reference.

File attachments are unlikely to survive to most readers of this forum
(they get dropped, to reduce traffic size and spam and dangerous
attachments).

Instead, keep the program code short and simple; then, copy and paste it
exactly into the text body of your message. That's much more likely to
let us see exactly what you're seeing.

-- 
 \  “Better not take a dog on the space shuttle, because if he |
  `\   sticks his head out when you're coming home his face might burn |
_o__)up.” —Jack Handey |
Ben Finney

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


Re: Futurize maps StringIO.StringIO to io.StringIO

2018-03-08 Thread Mark Lawrence

On 08/03/18 02:34, Skip Montanaro wrote:

I had some deja vu recently, cuz of this old thread:

https://mail.python.org/pipermail/python-list/2013-May/648245.html

Today the context is different, but the problem remains the same. One
of the futurize refactoring tools converts usage of StringIO.StringIO
to io.StringIO, which, given that the latter accepts just about
anything you through at it, is a bit surprising. Perhaps there is no
true corresponding class in the io module?

Skip



Maybe you need io.BytesIO?

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


I am a student studying Python in Korea. I found strange thing while studying through idle

2018-03-08 Thread 노연수
If you type print (" hello\ rpython ") into the python 3.7.0.b2, only the 
python is printed and i learned it's a crystal. However, if you type print (" 
hello\ rpython ") in the python 3.7.0.b2 idle, it is output as hellopython. I 
wonder why it prints like this. I would appreciate your answer. 
 
I have attached the file so I would appreciate your reference. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Relationship between ‘object’ and the name of an object (was: Which part of the loop is it going through in this class frame?)

2018-03-08 Thread Ben Finney
C W  writes:

> A follow-up question:

(When you want to switch the discussion to a different subject, please
indicate that by changing the Subject field in your message.

I am not really clear on what you're asking, so I have guessed and made
a subject that I think summarises what you mean.)

> How did the value of "object" get passed to "time"? Obviously, they
> have different names. How did Python make that connection?

In the context of your original question, I think this one reveals that
you are missing some fundamental knowledge of how Python treats objects
and references.

Every object has a type. Types are themselves objects; the most basic
type, in Python, is named ‘object’.

Yes, already this makes it somewhat difficult to discuss these concepts
:-)

You will probably benefit greatly by reading and watching this
presentation by Ned Batchelder, that walks you through some common
minuderstandings, and replaces them with correct concepts for how Python
treats objects and references.

Facts and Myths about Names and Values


-- 
 \   “If you ever fall off the Sears Tower, just go real limp, |
  `\ because maybe you'll look like a dummy and people will try to |
_o__)catch you because, hey, free dummy.” —Jack Handey |
Ben Finney

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


Re: Which part of the loop is it going through in this class frame?

2018-03-08 Thread C W
Thank you guys, lots of great answers, very helpful. I got it!

A follow-up question:

How did the value of "object" get passed to "time"? Obviously, they have
different names. How did Python make that connection?

Code is below for convenience.

class Clock(object):
def __init__(self, time):
self.time = time
def print_time(self):
time = '6:30'
print(self.time)

clock = Clock('5:30')
clock.print_time()
5:30


Thank you!

On Thu, Mar 8, 2018 at 6:30 AM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> On Wed, 07 Mar 2018 16:57:51 -0500, C W wrote:
>
> > Hello,
> >
> > I am new to OOP. I'm a bit confused about the following code.
> >
> > class Clock(object):
> > def __init__(self, time):
> > self.time = time
>
> Here you set the instance attribute "self.time".
>
> > def print_time(self):
> > time = '6:30'
> > print(self.time)
>
> Here you set the local variable "time", which is completely unrelated to
> the attribute "self.time".
>
> If you are used to languages where "foo" inside a method is a short-cut
> for "self.foo" or "this.foo", Python does not do that. Local variables
> and instance attributes are distinct concepts, and Python keeps them
> distinct.
>
>
> > How does line-by-line execution run inside a frame?
>
> There isn't actually line-by-line execution as such, although it can be
> very similar. Before the interpreter runs Python code, it compiles it to
> byte-code, and then runs the byte-code. A single line of source code
> could result in any number of lines of byte code, from zero to an
> unlimited number.
>
> > How does __init__
> > work? I understand you must have __init__.
>
> You understand wrongly then :-)
>
> It is normal and common to have an __init__ method, but it is not
> compulsory. If your class doesn't need one, you don't need to write it.
>
> The __init__ method is the initialiser. Think of it as very similar to
> the constructor in some other languages, and for now the differences
> aren't important. The usual purpose of the __init__ method is to
> initialise the instance and set any attributes needed.
>
> > Is it run before print_time(),
>
> The __init__ method is called once, when the instance is first created.
> So the short answer is, yes, it will run before print_time(). But only
> once.
>
> > if so, why don't I just set self.time = '6:30' instead of
> > self.time = time?
>
> Because then every instance will be set to 6:30, instead of letting you
> set each instance to a different time.
>
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unnoticed traceback in a thread (Posting On Python-List Prohibited)

2018-03-08 Thread Rob Gaddi

On 03/08/2018 05:06 PM, Lawrence D’Oliveiro wrote:

On Friday, March 9, 2018 at 11:43:00 AM UTC+13, Paul Rubin wrote:

That you're using threading.Lock for something like this is a borderline
code smell.


Any use of multithreading in non-CPU-intensive code is a code smell.



But CPU intensive code is exactly the circumstance where Python 
threading lets you down.  It really shines when you're I/O-bound.


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


[issue33033] Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking

2018-03-08 Thread Antony Lee

New submission from Antony Lee :

At https://docs.python.org/3/c-api/arg.html#numbers, it is explicitly 
documented that the unsigned number convertors do not perform overflow 
checking.  Implicitly, this suggests that the signed convertors *do* perform 
overflow checking, which they indeed do; but it would be nice to document this 
behavior explicitly (as overflow checking is not always expected of C-level 
functions).

--
assignee: docs@python
components: Documentation
messages: 313471
nosy: Antony.Lee, docs@python
priority: normal
severity: normal
status: open
title: Clarify that the signed number convertors to PyArg_ParseTuple... *do* 
overflow checking
versions: Python 3.6

___
Python tracker 

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



Re: Spot the invalid syntax

2018-03-08 Thread MRAB

On 2018-03-08 23:57, Ben Finney wrote:

Chris Angelico  writes:


On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney  wrote:
> In many cases, those eyes can be virtual and non-human.
>
> That's what syntax highlighting, and tools even more impressive
> (e.g. linting tools that run continually), offer in a programmer's
> text editor: a pair of eyes looking for mistakes while you type.

Often true, but not always.


You mean the tool is not always looking for mistakes while you type?

If you mean that the tool doesn't catch all mistakes: of course not, and
I didn't imply it would. Are you saying that's a reason against using
such automated tools? (If not, I don't really understand what objection
you're making.)

Certainly it'd be good to always have a *perfect* overseer checking for
mistakes . Until that happy day, though, let's use the
tools available to improve our code before even attempting to run it.


"... while one types"? I'm not so sure.

In the past I've used an IDE (not for Python) that, for example, 
underlined any identifiers that hadn't been defined, but found it 
annoying because it was indicating errors that were due to my not having 
finished writing yet!


Type, pause for thought, syntax error... yes, I know it's a syntax error 
at the moment, but I'm not finished!

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


Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher

On 03/08/2018 05:30 PM, Ben Finney wrote:

Not sufficiently, it seems. Check the line preceding the ‘return’
statement.


Indeed.  :-/


Then, switch to using a programmer's text editor (I prefer Emacs) that
can spot these syntax errors while you type.


The sad thing is that I am.  Just too bone-headed to use properly,
apparently.

--

Ian Pilcher arequip...@gmail.com
 "I grew up before Mark Zuckerberg invented friendship" 


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


Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher

On 03/08/2018 05:26 PM, Chris Angelico wrote:

On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher  wrote:

(Because I certainly can't.)


 ips.update(_san_dnsname_ips(cname, True)
 return ips

I've checked for tabs and mismatched parentheses.


Check the immediately preceding line (the one I quoted).

(Sometimes, you just need another pair of eyes.)



D'oh!

Clearly, my checking needs work.

Thanks mucho!

--

Ian Pilcher arequip...@gmail.com
 "I grew up before Mark Zuckerberg invented friendship" 


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


Re: Spot the invalid syntax

2018-03-08 Thread Bob van der Poel
On Thu, Mar 8, 2018 at 4:23 PM, Ian Pilcher  wrote:

> (Because I certainly can't.)
>
> def _san_dnsname_ips(dnsname, dnsname_is_cname=False):
>> """
>> Returns a set of IP addresses, managed by this IPa instance,
>> that correspond to the DNS name (from the subjectAltName).
>>
>> """
>> fqdn = dnsutil.DNSName(dnsname).make_absolute()
>> if fqdn.__len__() < 4:
>> logger.debug("Skipping IPs for %s: hostname too short" % dnsname)
>> return ()
>> zone = dnsutil.DNSName(resolver.zone_for_name(fqdn))
>> name = fqdn.relativize(zone)
>> try:
>> result = api.Command['dnsrecord_show'](zone, name)['result']
>> except errors.NotFound as nf:
>> logger.debug("Skipping IPs for %s: %s" % (dnsname, nf))
>> return ()
>> ips = set()
>> for ip in itertools.chain(result.get('arecord', ()),
>>   result.get('record', ())):
>> if _ip_rdns_ok(ip, fqdn):
>> ips.add(ip)
>> cnames = result.get('cnamerecord', ())
>> if cnames:
>> if dnsname_is_cname:
>> logger.debug("Skipping IPs for %s: chained CNAME" % dnsname)
>> else:
>> for cname in cnames:
>> if not cname.endswith('.'):
>> cname = u'%s.%s' % (cname, zone)
>> ips.update(_san_dnsname_ips(cname, True)
>> return ips
>>
>
> 2.7 and 3.6 are both giving me:
>
>   File "/tmp/test.py", line 32
> return ips
>  ^
> SyntaxError: invalid syntax
>
> I've checked for tabs and mismatched parentheses.
>
> Aargh!
>
> Check the line before the error. Seems there may be a ')' missing :)


> --
> 
> Ian Pilcher arequip...@gmail.com
>  "I grew up before Mark Zuckerberg invented friendship" 
> 
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: b...@mellowood.ca
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Spot the invalid syntax

2018-03-08 Thread Terry Reedy

On 3/8/2018 6:30 PM, Ben Finney wrote:

Ian Pilcher  writes:


 ips.update(_san_dnsname_ips(cname, True)

| <= auto-indent
If you type this code line in IDLE or other decent Python-aware code 
editor, the smart indent would put curser where I put the '|', thus 
indicating that there is no ')' matching the function call '('



 return ips


If you delete the helpful indent signal to type return here, ...



2.7 and 3.6 are both giving me:

   File "/tmp/test.py", line 32
 return ips
  ^
SyntaxError: invalid syntax

I've checked for tabs and mismatched parentheses.


IDLE, etc, flashes the ([{ opener for every )]} closer typed.
Not seeing an expected flash and seeing an unexpected indent catches 
most mismatches for me.



Not sufficiently, it seems. Check the line preceding the ‘return’
statement.

Then, switch to using a programmer's text editor (I prefer Emacs) that
can spot these syntax errors while you type.

I have never used Emacs, but I understand it has a decent Python-aware mode.

--
Terry Jan Reedy


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


Re: Spot the invalid syntax

2018-03-08 Thread MRAB

On 2018-03-08 23:23, Ian Pilcher wrote:

(Because I certainly can't.)


def _san_dnsname_ips(dnsname, dnsname_is_cname=False):
"""
Returns a set of IP addresses, managed by this IPa instance,
that correspond to the DNS name (from the subjectAltName).

"""
fqdn = dnsutil.DNSName(dnsname).make_absolute()
if fqdn.__len__() < 4:
logger.debug("Skipping IPs for %s: hostname too short" % dnsname)
return ()
zone = dnsutil.DNSName(resolver.zone_for_name(fqdn))
name = fqdn.relativize(zone)
try:
result = api.Command['dnsrecord_show'](zone, name)['result']
except errors.NotFound as nf:
logger.debug("Skipping IPs for %s: %s" % (dnsname, nf))
return ()
ips = set()
for ip in itertools.chain(result.get('arecord', ()),
  result.get('record', ())):
if _ip_rdns_ok(ip, fqdn):
ips.add(ip)
cnames = result.get('cnamerecord', ())
if cnames:
if dnsname_is_cname:
logger.debug("Skipping IPs for %s: chained CNAME" % dnsname)
else:
for cname in cnames:
if not cname.endswith('.'):
cname = u'%s.%s' % (cname, zone)
ips.update(_san_dnsname_ips(cname, True)
return ips


2.7 and 3.6 are both giving me:

File "/tmp/test.py", line 32
  return ips
   ^
SyntaxError: invalid syntax

I've checked for tabs and mismatched parentheses.

Aargh!


Look closely at the preceding line. Count the parentheses.

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


Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:57 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney  
>> wrote:
>> > In many cases, those eyes can be virtual and non-human.
>> >
>> > That's what syntax highlighting, and tools even more impressive
>> > (e.g. linting tools that run continually), offer in a programmer's
>> > text editor: a pair of eyes looking for mistakes while you type.
>>
>> Often true, but not always.
>
> You mean the tool is not always looking for mistakes while you type?
>
> If you mean that the tool doesn't catch all mistakes: of course not, and
> I didn't imply it would. Are you saying that's a reason against using
> such automated tools? (If not, I don't really understand what objection
> you're making.)

LOL! Sorry, I derped a bit on the grammar there. Yes, I meant that you
can often catch those mistakes with your editor, but not always. There
are some errors that cannot possibly be caught by an editor, of
course; but there are others that theoretically could be, but I almost
never see them. That's the point I was raising - not really an
objection, but a segue into my next comment.

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


Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico  writes:

> On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney  
> wrote:
> > In many cases, those eyes can be virtual and non-human.
> >
> > That's what syntax highlighting, and tools even more impressive
> > (e.g. linting tools that run continually), offer in a programmer's
> > text editor: a pair of eyes looking for mistakes while you type.
>
> Often true, but not always.

You mean the tool is not always looking for mistakes while you type?

If you mean that the tool doesn't catch all mistakes: of course not, and
I didn't imply it would. Are you saying that's a reason against using
such automated tools? (If not, I don't really understand what objection
you're making.)

Certainly it'd be good to always have a *perfect* overseer checking for
mistakes while one types. Until that happy day, though, let's use the
tools available to improve our code before even attempting to run it.

-- 
 \  “The fact that I have no remedy for all the sorrows of the |
  `\ world is no reason for my accepting yours. It simply supports |
_o__)  the strong probability that yours is a fake.” —Henry L. Mencken |
Ben Finney

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


Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney  wrote:
> Chris Angelico  writes:
>
>> (Sometimes, you just need another pair of eyes.)
>
> In many cases, those eyes can be virtual and non-human.
>
> That's what syntax highlighting, and tools even more impressive (e.g.
> linting tools that run continually), offer in a programmer's text
> editor: a pair of eyes looking for mistakes while you type.
>

Often true, but not always.

What would often be useful, but I've not usually (ever?) seen, is a
linter rule that continuation lines MUST be indented further than the
initial line. That would catch this problem, because the "return" line
is being misparsed as a continuation line, but it's indented far less.

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


Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico  writes:

> (Sometimes, you just need another pair of eyes.)

In many cases, those eyes can be virtual and non-human.

That's what syntax highlighting, and tools even more impressive (e.g.
linting tools that run continually), offer in a programmer's text
editor: a pair of eyes looking for mistakes while you type.

-- 
 \ “Giving every man a vote has no more made men wise and free |
  `\  than Christianity has made them good.” —Henry L. Mencken |
_o__)  |
Ben Finney

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


Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Ian Pilcher  writes:

> > ips.update(_san_dnsname_ips(cname, True)
> > return ips
>
> 2.7 and 3.6 are both giving me:
>
>   File "/tmp/test.py", line 32
> return ips
>  ^
> SyntaxError: invalid syntax
>
> I've checked for tabs and mismatched parentheses.

Not sufficiently, it seems. Check the line preceding the ‘return’
statement.

Then, switch to using a programmer's text editor (I prefer Emacs) that
can spot these syntax errors while you type.

-- 
 \ “Nothing worth saying is inoffensive to everyone. Nothing worth |
  `\saying will fail to make you enemies. And nothing worth saying |
_o__)will not produce a confrontation.” —Johann Hari, 2011 |
Ben Finney

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


Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher  wrote:
> (Because I certainly can't.)
>
>> ips.update(_san_dnsname_ips(cname, True)
>> return ips
>
>
> 2.7 and 3.6 are both giving me:
>
>   File "/tmp/test.py", line 32
> return ips
>  ^
> SyntaxError: invalid syntax
>
> I've checked for tabs and mismatched parentheses.

Check the immediately preceding line (the one I quoted).

(Sometimes, you just need another pair of eyes.)

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


[issue33032] Mention implicit cache in struct.Struct docs

2018-03-08 Thread Nick Coghlan

Nick Coghlan  added the comment:

The note on https://docs.python.org/3/library/re.html#re.compile provides a 
useful precedent for possible wording here, as the struct cache and the regex 
cache are quite similar.

--

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

> We know that the path is valid because we have a handle (in this case the 
> file system ensures that no parent directory in the path can be unlinked or 
> renamed).

Thank you for pointing this out. I erroneously stated that the length of the 
path could increase between GetFinalPathNameByHandle calls because an 
intermediate directory could be renamed, but actually I've only checked that 
the last part can be renamed (or even deleted, though it'll still linger in 
inaccessible state until the handle is closed).

--

___
Python tracker 

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



Spot the invalid syntax

2018-03-08 Thread Ian Pilcher

(Because I certainly can't.)


def _san_dnsname_ips(dnsname, dnsname_is_cname=False):
"""
Returns a set of IP addresses, managed by this IPa instance,
that correspond to the DNS name (from the subjectAltName).

"""
fqdn = dnsutil.DNSName(dnsname).make_absolute()
if fqdn.__len__() < 4:
logger.debug("Skipping IPs for %s: hostname too short" % dnsname)
return ()
zone = dnsutil.DNSName(resolver.zone_for_name(fqdn))
name = fqdn.relativize(zone)
try:
result = api.Command['dnsrecord_show'](zone, name)['result']
except errors.NotFound as nf:
logger.debug("Skipping IPs for %s: %s" % (dnsname, nf))
return ()
ips = set()
for ip in itertools.chain(result.get('arecord', ()),
  result.get('record', ())):
if _ip_rdns_ok(ip, fqdn):
ips.add(ip)
cnames = result.get('cnamerecord', ())
if cnames:
if dnsname_is_cname:
logger.debug("Skipping IPs for %s: chained CNAME" % dnsname)
else:
for cname in cnames:
if not cname.endswith('.'):
cname = u'%s.%s' % (cname, zone)
ips.update(_san_dnsname_ips(cname, True)
return ips


2.7 and 3.6 are both giving me:

  File "/tmp/test.py", line 32
return ips
 ^
SyntaxError: invalid syntax

I've checked for tabs and mismatched parentheses.

Aargh!

--

Ian Pilcher arequip...@gmail.com
 "I grew up before Mark Zuckerberg invented friendship" 


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


[issue33032] Mention implicit cache in struct.Struct docs

2018-03-08 Thread Nick Coghlan

New submission from Nick Coghlan :

The struct.Struct docs claim that creating and re-using a Struct object will be 
noticeably faster than calling the module level methods repeatedly with the 
same format string, as it will avoid parsing the format string multiple times: 
https://docs.python.org/3/library/struct.html#struct.Struct

This claim is questionable, as struct has used an internal Struct cache since 
at least 2.5, so if you're using less than 100 different struct layouts in any 
given process, the only thing you'll be saving is a string-keyed dictionary 
lookup.

--
assignee: docs@python
components: Documentation
messages: 313468
nosy: docs@python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Mention implicit cache in struct.Struct docs
type: enhancement
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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

> unless users are not prepared to deal with it
ARE prepared

> What do you think about handling this failure by calling GetFullPathName 
> instead (e.g. "C:\Temp\NUL" => "\\.\NUL")?

I think it would indeed be nice if pathlib handled such paths in its resolve(), 
especially since os.path.abspath() does handle them, and it looks weird that 
even resolve(strict=False) fails. That could be an enhancement, but note that 
it'll expose users to '\\.\'-prefixed paths which can't be returned from 
resolve() now. It is not necessary a problem because users should be prepared 
to handle UNC-like paths anyway.

> Currently pathlib's resolve method doesn't handle PermissionError like I 
> think it should in non-strict mode. It only handles FileNotFoundError

That behavior doesn't look good, and it's inconsistent with POSIX resolve() 
which doesn't propagate any OSError in non-strict mode. I think this warrants 
an issue report.

--

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

> Because we only try VOLUME_NAME_DOS, this function always fails for a volume 
> that's not mounted as either a drive letter or a junction mount point.

If a volume is not mounted, users have to use \\?\ or \\.\ either directly or 
indirectly via a symlink or a junction to get to it, right? Do you think such 
uses are common enough to warrant dealing with VOLUME_NAME_GUID? Also note that 
pathlib currently expects DOS paths only: it will strip '\\?\' prefix in 
resolve(), making GUID path "invalid" (and, also, precluding direct usage of 
'\\?\' prefix with resolve() in other cases unless users are not prepared to 
deal with it).

--

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:

Leaving this open for commit review (and buildbots) for a little while, but 
then I'll close it if we're all good.

--
assignee:  -> steve.dower
stage: patch review -> commit review

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:


New changeset 32efcd13069a89abf007373274ee1bc0909d1996 by Steve Dower in branch 
'3.6':
bpo-33016: Fix potential use of uninitialized memory in nt._getfinalpathname 
(GH-6032)
https://github.com/python/cpython/commit/32efcd13069a89abf007373274ee1bc0909d1996


--

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

Copying the comment of @eryksun from PR 6010 for reference.

Because we only try VOLUME_NAME_DOS, this function always fails for a volume 
that's not mounted as either a drive letter or a junction mount point. The 
error in this case is ERROR_PATH_NOT_FOUND. We know that the path is valid 
because we have a handle (in this case the file system ensures that no parent 
directory in the path can be unlinked or renamed). To address this, if the 
flags parameter isn't already VOLUME_NAME_GUID, it could switch to it and 
continue the while loop (no need to realloc). Otherwise if it's already 
VOLUME_NAME_GUID or for any other error, the call should fail.

For DOS devices in paths (e.g. "C:\Temp\NUL"), CreateFile commonly succeeds, 
but GetFinalPathNameByHandle commonly fails with either ERROR_INVALID_FUNCTION 
or ERROR_INVALID_PARAMETER. What do you think about handling this failure by 
calling GetFullPathName instead (e.g. "C:\Temp\NUL" => "\\.\NUL")? That way 
most DOS device paths won't cause this function to fail (e.g. when called by 
pathlib's resolve method). We could do the same if CreateFile fails with 
ERROR_INVALID_PARAMETER, which should only occur for CON (e.g. "C:\Temp\CON") 
because it needs to be opened with either generic read or generic write access.

CreatFile also commonly fails here with either ERROR_SHARING_VIOLATION (from a 
paging file) or ERROR_ACCESS_DENIED. But I think those are best handled by the 
caller, with a PermissionError exception handler. Currently pathlib's resolve 
method doesn't handle PermissionError like I think it should in non-strict 
mode. It only handles FileNotFoundError

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

@eryksun Very interesting! BTW, I looked at CreateFile docs, and the fact that 
it may set the last error to zero is even documented there.

@steve.dower
> maybe we don't have to preserve errno on Windows?

There are still places where errno is relied upon. PR 5784 shows one such 
place: os.[f]truncate(). Others are e.g. os.open() and os.lseek().

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Eryk Sun

Eryk Sun  added the comment:

FYI, here's a sampling of successful calls that modify the last error value.

Most Create- functions intentionally set the last error to 0 on success, such 
as CreateFile, CreateFileMapping, CreateSymbolicLink, CreateJobObject, 
CreateEvent, CreateMutex, CreateSemaphore, and CreateWaitableTimer. 

Some other functions also intentionally set the last error to 0 on success, 
such as SetWaitableTimer and the functions that work with security identifiers 
(SIDs) such as EqualSid, GetLengthSid, GetSidIdentifierAuthority, and 
GetSidSubAuthority.

The return value of some functions is the low DWORD of a file size, such as 
GetCompressedFileSize, GetFileSize, and SetFilePointer. In this case 0x 
is either a valid size or indicates an error. The function is forced to clarify 
this by setting the last error to 0 on success. GetFileSizeEx and 
SetFilePointerEx are preferred, since they don't have this problem.

Some functions make internal calls to CreateFile or DeviceIoControl. These 
cases might even set the last error to a non-zero value on success. Examples 
include GetVolumePathName (e.g. ERROR_MORE_DATA from DeviceIoControl), 
GetFinalPathNameByHandle (opening  "\\.\MountPointManager"), and GetDriveType 
(e.g. for junction mountpoints).

--
nosy: +eryksun

___
Python tracker 

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



[issue32642] add support for path-like objects in sys.path

2018-03-08 Thread Jay Yin

Jay Yin  added the comment:

The issue was resolved by updating my version of the rest of the package 
apparently and remaking the whole thing, must have been some outdated stuff on 
my end causing the issue

--

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-03-08 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Also, updating ssl.SSLContext documentation about intentional inability to copy 
generically and suggestion how to go about it if you need to obtain a clone or 
similar would be terrific and save developers time so they won't run into this 
gotcha when designing and implementing solutions. Many thanks!

--

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-03-08 Thread Vitaly Kruglikov

Vitaly Kruglikov  added the comment:

Hi Christian, thank you for following up. Here is my use case, and perhaps you 
can suggest something else that will work:

I am refactoring the transport layer in the Pika AMQP client library. The user 
provides an ssl.SSLContext instance for connecting to an AMQP broker (e.g., 
RabbitMQ). Pika will resolve the hostname via getaddrinfo and make attempts to 
establish TCP and AMQP connection to the candidate IP addresses until one 
succeeds in establishing an AMQP connection over SSL. Each connection attempt 
will require a fresh unadulterated clone of the ssl.SSLContext instance 
provided by user to avoid any side-effects from prior connection attempts.

How can I obtain this pristine clone cleanly for each new connection attempt?

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:

> Before take_gil() knows whether it has to do any work

I thought we had a check for when the GIL was not even initialized, but that 
doesn't seem to exist in master any more.

Preserving GetLastError() at the same place we do errno is probably sufficient. 
There shouldn't be any more of a performance penalty (and maybe we don't have 
to preserve errno on Windows? That will save a TLS lookup at least)

--

___
Python tracker 

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



Unnoticed traceback in a thread

2018-03-08 Thread Skip Montanaro
I have a program which is almost always running in a single thread. It
uses a daemon thread (via threading.Timer) to periodically checkpoint
some state. The program runs for days at a time.

Over the past couple days, two instances of the subthread croaked with
tracebacks because while they were iterating over the checkpointable
data, the main thread modified the data. Blammo! It was an easy fix
(threading.Lock) and everything is back on an even keel.

After the bug was tickled, the program continued to do its thing. It
just stopped checkpointing. Given the way the program is managed, the
traceback wound up in an obscure log file, and it was a couple days
before I noticed it. I've seen this sort of
thread-dies-but-program-doesn't-crash situation before. I can look at
ways to more actively monitor the contents of the obscure log file,
but is there some non-hackish way that the demise of the daemon thread
can take down the entire program? (Sometimes it's good that it doesn't
crash. Other times it would at least be handy if it did.)

Thx,

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


[issue32981] Catastrophic backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
keywords: +security_issue
nosy: +larry
priority: normal -> critical
title: Catastrophic backtracking in poplib and difflib -> Catastrophic 
backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)
versions: +Python 2.7, Python 3.4, Python 3.5, 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



[issue26701] Documentation for int constructor mentions __int__ but not __trunc__

2018-03-08 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What about __floor__ and __ceil__?

I think all these three method do not deserve separate paragraphs in 
Doc/reference/datamodel.rst, but they should be grouped together with __round__.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-08 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

You should also think about loop lifecycle: right now it's using the same loop 
for all test cases, so callbacks can leak between tests. Twisted actually goes 
a step further and explicitly checks for left over callbacks and fails the test 
if any are found.

--

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib and difflib

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
pull_requests: +5797

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib and difflib

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
pull_requests: +5796

___
Python tracker 

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



[issue33029] Invalid function cast warnings with gcc 8 for getter and setter functions

2018-03-08 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage:  -> needs patch
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



[issue32972] unittest.TestCase coroutine support

2018-03-08 Thread Petter S

Petter S  added the comment:

> 1. Do we need support for async versions of setUp, setUpClass, etc?  In my 
> opinion: yes.

I completely agree. I would imagine many or most real-world tests requiring 
async setUp. There is also the question on how a custom loop etc. can be used 
in the unit test class.

How about this: unittest.TestCase gets a very small refactor in which a 
overridable helper method is used to run the test method. This helper method 
can then be changed to run async methods in a subclass AsyncioTestCase (that 
probably should live in asyncio).

Pull request 6005 contained such a helper method, but the async part could be 
implemented in the subclass instead.

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

> Ideally, if we don't have to do any work to reacquire the GIL, we shouldn't 
> do any work to preserve the error code either.

Before take_gil() knows whether it has to do any work, it calls 
MUTEX_LOCK(_PyRuntime.ceval.gil.mutex), which is either EnterCriticalSection() 
or AcquireSRWLockExclusive(). So unless we can be sure that those functions 
can't clobber the last error (or we redesign GIL to have a fast-path like an 
atomic compare-exchange in non-contended case), I don't see how we can avoid 
the last error bookkeeping.

--

___
Python tracker 

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



[issue33031] Questionable code in OrderedDict definition

2018-03-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The array of PyMethodDef for OrderedDict contains explicit definitions of 
methods like __delitem__, __eq__ and __init__. The purpose is aligning 
docstrings with Python implementation. But this doesn't work. Slot wrappers 
replace these descriptors. And docstings are standard docstrings for 
corresponding slot wrappers.

Thus this code doesn't work. And it looks dangerous, since functions are casted 
to incompatible function types. Even if they are never used, the compiler (gcc 
8) produces warnings (see issue33012). May be this is even undefined behavior. 
In that case the compiler can generate arbitrary code.

I suggest to remove these definitions.

--
components: Extension Modules
messages: 313452
nosy: eric.snow, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Questionable code in OrderedDict definition
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



Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Etienne Robillard

OK I got it, thank you! :)

Essentially, I want to develop a psychocomputational analysis toolkit in 
Python for studying real-time neuroimaging data (of cortical activity) 
from low-intensity, focused ultrasounds (LIFU) and possibly emulate a 
functional brain-to-brain coupling system on my 32-bit computer as a 
proof-of-concept to demonstrate the vulnerability of the human cochlear 
pathway to become a target of sophisticated ultrasonic side-channel 
attacks from mobile devices.


Etienne


Le 2018-03-08 à 10:31, Christopher Mullins a écrit :
> Would it be possible to emulate a minimally functional 
brain-to-brain coupling system entirely in Python?


I don't know what that would entail, but the links I shared have a 
mailing list and a very responsive gitter, both of which would be 
great places to ask about that!  (You're welcome to ask here of 
course, but this being the general python mailing list, it's a shot in 
the dark.)  Good luck!


Chris


--
Etienne Robillard
tkad...@yandex.com
https://www.isotoperesearch.ca/

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


[issue29871] Enable optimized locks on Windows

2018-03-08 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
nosy: +izbyshev

___
Python tracker 

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



[issue32592] Drop support of Windows Vista in Python 3.7

2018-03-08 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
nosy: +izbyshev

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-08 Thread Yury Selivanov

Yury Selivanov  added the comment:

> That code does not seem to work for me:
> https://gist.github.com/PetterS/f684095a09fd1d8164a4d8b28ce3932d
> I get "RuntimeWarning: coroutine 'test_async_with_mock' was never awaited"

> @mock.patch needs to work correctly for test methods.
> [..]
> No, unittest.TestCase can handle this, as demonstrated by two PRs in this 
> bug. This would not change the behavior of existing (working) code.

Correct, and while it's possible to fix my little helper to work with mocks, 
you're completely right that we can, indeed, implement async support in 
TestCase without a metaclass.  My mistake here, thanks for correcting!

In any case, while I think we can now talk about augmenting TestCase, I'd still 
want to first discuss few other issues:

1. Do we need support for async versions of setUp, setUpClass, etc?  In my 
opinion: yes.

2. There're a few options how to implement (1):

a) Add async support to TestCase. Automatically detect when a test is async, or 
when 'setUp' and friends are async and run them all with 'asyncio.run'.

b) Add async support to TestCase.  Add asyncSetUp, asyncSetUpClass, etc magic 
methods.  The argument in favour of this approach over (a) is that it's 
possible to safely use 'super()' calls when you have multiply inherited 
TestCases.

c) Add a new AsyncioTestCase specifically for working with asyncio (combine 
with option (b)).

I still don't like (a) because it involves too much implicit logic.  I think 
that it's simple enough to inherit your testcase from unittest.AsyncioTestCase 
and read a separate documentation specifically about it and not about generic 
TestCase.

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:

> GetLastError() docs officially scare us

I believe this is a case where the docs were updated from intended/correct 
behavior to actual behavior, which happens from time to time and is never 
clearly marked.

As I say, they are _supposed_ to leave the error unchanged unless they return a 
value that indicates an error occurred, but some APIs behave incorrectly. The 
docs are simply documenting that fact. (It turns out reality is more useful 
than fantasy ;) though I do wish they were clearer about that)

--

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

FWIW, GetLastError() docs[1] officially scare us:

Most functions that set the thread's last-error code set it when they fail. 
However, some functions also set the last-error code when they succeed. If the 
function is not documented to set the last-error code, the value returned by 
this function is simply the most recent last-error code to have been set; some 
functions set the last-error code to 0 on success and others do not.

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms679360(v=vs.85).aspx

--
nosy: +izbyshev

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread miss-islington

miss-islington  added the comment:


New changeset 8c163bbf370f6f6cedd2c07f7d54c9b36c97d8f2 by Miss Islington (bot) 
in branch '3.7':
bpo-33016: Fix potential use of uninitialized memory in nt._getfinalpathname 
(GH-6010)
https://github.com/python/cpython/commit/8c163bbf370f6f6cedd2c07f7d54c9b36c97d8f2


--
nosy: +miss-islington

___
Python tracker 

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



[issue33030] GetLastError() may be overwritten by Py_END_ALLOW_THREADS

2018-03-08 Thread Steve Dower

New submission from Steve Dower :

Most Win32 API calls are made within Py_BEGIN_ALLOW_THREADS blocks, as they do 
not access Python objects and so we can release the GIL.

However, in general, error handling occurs after the Py_END_ALLOW_THREADS line. 
Due to the design of the Win32 API, the pattern looks like this:

Py_BEGIN_ALLOW_THREADS
ret = ApiCall(...);
Py_END_ALLOW_THREADS
if (FAILED(ret)) {
error_code = GetLastError();
}

However, Py_END_ALLOW_THREADS also makes Win32 API calls (to acquire the GIL), 
and if any of these fail then the error code may be overwritten.

Failures in Py_END_ALLOW_THREADS are either fatal (in which case we don't care 
about the preceding error any more) or signal a retry (in which case we *do* 
care about the preceding error), but in the latter case we may have lost the 
error code.

Further, while Win32 APIs are not _supposed_ to set the last error to 
ERROR_SUCCESS (0) when they succeed, some occasionally do.

We should update Py_END_ALLOW_THREADS to preserve the last error code when 
necessary. Ideally, if we don't have to do any work to reacquire the GIL, we 
shouldn't do any work to preserve the error code either.

--
components: Windows
messages: 313447
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: GetLastError() may be overwritten by Py_END_ALLOW_THREADS
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue28113] Remove Py_CreateSymbolicLinkW

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:

We should look at merging this, though we need a few things to be done first 
(anyone can jump in and do these, doesn't have to be Eryk):

* patch needs to be converted to a GitHub PR
* we should use unique names within %TEMP% to avoid conflicts between tests 
running in parallel
* PEP 7 has changed since the original patch
* NEWS and maybe a What's New entry?

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Steve Dower

Change by Steve Dower :


--
pull_requests: +5795

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5794

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-08 Thread Steve Dower

Steve Dower  added the comment:


New changeset 3b20d3454e8082e07dba93617793de5dc9237828 by Steve Dower (Alexey 
Izbyshev) in branch 'master':
bpo-33016: Fix potential use of uninitialized memory in nt._getfinalpathname 
(#6010)
https://github.com/python/cpython/commit/3b20d3454e8082e07dba93617793de5dc9237828


--

___
Python tracker 

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



Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Bob Gailer
On Mar 8, 2018 10:08 AM, "Etienne Robillard"  wrote:
>
> Thanks for sharing this link. MNE looks pretty cool. :-)
>
> I'm mostly interested in mapping specific cortical pathways to
brain-to-brain interfaces implicated in the ultrasonic neuromodulation of
behavior.
>
> Would it be possible to emulate a minimally functional brain-to-brain
coupling system entirely in Python?

Since python is a general purpose programming language, I'd say yes. I
would add the use of a database management system, since you need some way
of storing the data. sqlite is an excellent database management system with
an excellent python interface. Unlike other database systems, sqlite is
single-user system. You can always migrate later to a multi-user system.

The sqlite3 module is included in the python distribution.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
resolution:  -> fixed
stage: backport needed -> resolved
status: open -> closed
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: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Christopher Mullins
> Would it be possible to emulate a minimally functional brain-to-brain
coupling system entirely in Python?

I don't know what that would entail, but the links I shared have a mailing
list and a very responsive gitter, both of which would be great places to
ask about that!  (You're welcome to ask here of course, but this being the
general python mailing list, it's a shot in the dark.)  Good luck!

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


[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2018-03-08 Thread Ned Deily

Ned Deily  added the comment:


New changeset 2f3ba27185a369bcb6b36b13aa3518ffcc970ffa by Ned Deily (Miss 
Islington (bot)) in branch '3.6':
[3.6] bpo-30353: Fix pass by value for structs on 64-bit Cygwin/MinGW (GH-1559) 
(GH-5954)
https://github.com/python/cpython/commit/2f3ba27185a369bcb6b36b13aa3518ffcc970ffa


--
nosy: +ned.deily

___
Python tracker 

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



[issue33028] tempfile.TemporaryDirectory incorrectly documented

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
type: enhancement -> 

___
Python tracker 

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



[issue33028] tempfile.TemporaryDirectory incorrectly documented

2018-03-08 Thread Ned Deily

Change by Ned Deily :


--
nosy: +lars.gustaebel
versions: +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



[issue33029] Invalid function cast warnings with gcc 8 for getter and setter functions

2018-03-08 Thread Siddhesh Poyarekar

New submission from Siddhesh Poyarekar :

gcc 8 has added a new warning heuristic to detect invalid function casts and a 
stock python build seems to hit that warning quite often.  bug 33012 fixes the 
most trivial case of METH_NOARGS, this bug is to track a similarly trivial but 
widely applicable fix, which is to cast getter and setter functions.

Patches coming up over the weekend.

--
components: Build
messages: 313443
nosy: siddhesh
priority: normal
severity: normal
status: open
title: Invalid function cast warnings with gcc 8 for getter and setter functions
type: compile error

___
Python tracker 

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-03-08 Thread Siddhesh Poyarekar

Change by Siddhesh Poyarekar :


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

___
Python tracker 

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



Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Etienne Robillard

Thanks for sharing this link. MNE looks pretty cool. :-)

I'm mostly interested in mapping specific cortical pathways to 
brain-to-brain interfaces implicated in the ultrasonic neuromodulation 
of behavior.


Would it be possible to emulate a minimally functional brain-to-brain 
coupling system entirely in Python?


Best regards,

Etienne


Le 2018-03-08 à 09:44, Christopher Mullins a écrit :
You might find MNE useful, and if what you're doing happens to fit 
somewhere in their package you could contribute to it -- they're a 
good group to work with.


https://www.martinos.org/mne/stable/index.html
https://github.com/mne-tools/mne-python


--
Etienne Robillard
tkad...@yandex.com
https://www.isotoperesearch.ca/

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


Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Christopher Mullins
You might find MNE useful, and if what you're doing happens to fit
somewhere in their package you could contribute to it -- they're a good
group to work with.

https://www.martinos.org/mne/stable/index.html
https://github.com/mne-tools/mne-python
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

PR 5944 changes ABC.__subclasscheck__ (not issubclass) to check its first 
argument, so if it's merged there will be no crash even with the revert.

--

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

> Can 
> https://github.com/python/cpython/commit/fc7df0e664198cb05cafd972f190a18ca422989c
>  be reverted?

Even if subclass() will check explicitly that its first argument is a type, 
ABC.__subclasscheck__() can be called directly, and it shouldn't crash when 
called with non-type.

--

___
Python tracker 

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



psychocomputational analysis toolkit in Python?

2018-03-08 Thread Etienne Robillard

Hi

i want to develop a psychocomputational analysis toolkit in python for 
studying real-time neuroimaging data from focused 
ultrasound/brain-to-brain interfaces.


Any suggestions where to look for cool projects in github? :)

Best regards,

Etienne


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/
https://www.isotoperesearch.ca/

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


[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

> Isn't it just a limitation?
> Most Python-implemented objects supports weakref. I don't think "requiring 
> weakref support implies it must be type object".

Formally, there is no implication. It is the abc module authors who know the 
truth. But I can't imagine why anybody would impose such a limitation by 
design, because while instances of user-defined classes support weakrefs, 
built-in classes used by everybody like tuple, list and dict don't. That's why 
I guessed that non-types were not meant to be supported.

> What "by OP" means?
OP = Original poster (@jab).

> I can't find `if not issubclass(cls, type): raise TypeError` in Reversible 
> implementation.
> They do duck-typing, same to ABC.

Sorry for being unclear. There is no explicit check as you say, but __mro__ is 
directly accessed (see msg313376). But it may probably be considered "duck 
typing" too.

> But I don't know much about how mages use ABC.  I need mages comment before 
> merging the pull request.
Totally agree.

> BTW, do you think it should be backported to 3.7, or even 3.6?
3.7 certainly has my vote -- this can hardly be considered a new feature.

For 3.6, I'd listen to ABC users/experts. Might raising a TypeError instead of 
returning False from issubclass(user_defined_obj, ABC) break something 
important? Personally, I think it would mostly expose bugs and not hinder 
reasonable usage.  

> Can 
> https://github.com/python/cpython/commit/fc7df0e664198cb05cafd972f190a18ca422989c
>  be reverted?

Seems like it can, but the test should survive in some form :)

--

___
Python tracker 

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



[issue30353] ctypes: pass by value for structs broken on Cygwin/MinGW 64-bit

2018-03-08 Thread Erik Bray

Erik Bray  added the comment:

This has a backport PR now for 3.6.  Once that PR is merged I think we can 
close this as fixed.

--
stage: patch review -> backport needed
versions: +Python 3.6

___
Python tracker 

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



[issue32972] unittest.TestCase coroutine support

2018-03-08 Thread Petter S

Petter S  added the comment:

> No, it shouldn't break them if you wrap async methods carefully.
> Here's a metaclass that I wrote recently doing just that

That code does not seem to work for me:
https://gist.github.com/PetterS/f684095a09fd1d8164a4d8b28ce3932d
I get "RuntimeWarning: coroutine 'test_async_with_mock' was never awaited"

@mock.patch needs to work correctly for test methods.

>> I'm really not seeing what a separate class buys you.
> I already mentioned in my previous comments that adding async support to 
> unittest.TestCase would require us to add a metaclass to it, which is 
> potentially a backwards incompatible change.

No, unittest.TestCase can handle this, as demonstrated by two PRs in this bug. 
This would not change the behavior of existing (working) code.

--

___
Python tracker 

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



EuroPython 2018: Hotel tips and general update

2018-03-08 Thread M.-A. Lemburg
As you may know, the Edinburgh Fringe Festival is starting one week
after EuroPython 2018 in Edinburgh. Since this typically attracts many
thousands of people and artists, the hotels are filling up quickly in
Edinburgh.

If you’re planning to attend EuroPython, please book your hotel
early. Many booking sites offer free cancellations, so there’s no risk
in making reservations now, even if you decide not to come in the end.

Room allocation for EuroPython 2018
---

To help with this, we have partnered with the Edinburgh Convention
Bureau to set aside a number of hotel rooms which are reserved for
EuroPython attendees. These rooms will be held reserved until a few
weeks before the conference and are also available with a free
cancellation option.

The Edinburgh Convention Bureau has setup the following website for
booking rooms from this allocation:

* EuroPython 2018 Hotel Booking Website *
https://cabsedinburgh.eventsair.com/QuickEventWebsitePortal/europython-2018/home-page
(run by the Edinburgh Convention Bureau)


Update on EuroPython 2018
-

Meanwhile, we wanted to give you an update of where we are with the
conference organization:

We are still working on getting everything setup for launching the
website, opening ticket sales and the Call for Proposals (CFP).

This year the EuroPython Society (EPS) will be running the ticket
sales, rather than a local organization and we are facing some
challenges related to VAT taxes, which are taking longer to sort out
than expected.

This is the main reason for the delay you are seeing, but we’re
getting there.


Enjoy,
--
EuroPython 2018 Team
https://ep2018.europython.eu/
https://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/971716086445027328
Thanks.

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

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


ANN: pygameweb 0.0.4 - Northern Rockhopper Penguin

2018-03-08 Thread René Dudfield
G'day.




pygameweb  is the source code for
the pygame
website  at https://www.pygame.org/

[image: 6954251406_95ebe75f55_m]


   - #52  Adding ability to
   deploy through travisci. And docs.
   - #46  Wiki readability.
   Wiki tools on left out of reading line.
   - Twitter card for releases. For nicer view when posting to twitter.
   - Wiki table of contents improvements.
   - builds docs for pygame, when something lands on pygame github master
   branch.
   - project release feeds bugfix.
   - Only show one recent release for each project. Some projects release a
   few times in a row.
   - Wiki, nicer pre code handling.
   - Wiki code uses inline colors, so copy/paste works with colors too.
   - use https for login and register buttons, even when on http (see Why
   can't we turn off HTTPS?
   ).
   - Ask more bad robot web crawlers not to be bad.

See a full diff of changes since last release
.

Majestic photo of a Northern Rockhopper Penguin by Brian Gratwicke

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

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


ANN: pygameweb 0.0.4 - Northern Rockhopper Penguin

2018-03-08 Thread René Dudfield
G'day.




pygameweb  is the source code for
the pygame
website  at https://www.pygame.org/

[image: 6954251406_95ebe75f55_m]


   - #52  Adding ability to
   deploy through travisci. And docs.
   - #46  Wiki readability.
   Wiki tools on left out of reading line.
   - Twitter card for releases. For nicer view when posting to twitter.
   - Wiki table of contents improvements.
   - builds docs for pygame, when something lands on pygame github master
   branch.
   - project release feeds bugfix.
   - Only show one recent release for each project. Some projects release a
   few times in a row.
   - Wiki, nicer pre code handling.
   - Wiki code uses inline colors, so copy/paste works with colors too.
   - use https for login and register buttons, even when on http (see Why
   can't we turn off HTTPS?
   ).
   - Ask more bad robot web crawlers not to be bad.

See a full diff of changes since last release
.

Majestic photo of a Northern Rockhopper Penguin by Brian Gratwicke

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


[issue33025] urlencode produces bad output from ssl.CERT_NONE and friends that chokes decoders

2018-03-08 Thread Christian Heimes

Change by Christian Heimes :


--
assignee: christian.heimes -> 

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-03-08 Thread Christian Heimes

Christian Heimes  added the comment:

This is rather a feature than a bug. It is not possible to make a copy of a 
SSLContext object because OpenSSL doesn't support the operation. A context 
contains elements that can't be cloned easily, e.g. session resumption tickets.

--

___
Python tracker 

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



EuroPython 2018: Hotel tips and general update

2018-03-08 Thread M.-A. Lemburg
As you may know, the Edinburgh Fringe Festival is starting one week
after EuroPython 2018 in Edinburgh. Since this typically attracts many
thousands of people and artists, the hotels are filling up quickly in
Edinburgh.

If you’re planning to attend EuroPython, please book your hotel
early. Many booking sites offer free cancellations, so there’s no risk
in making reservations now, even if you decide not to come in the end.

Room allocation for EuroPython 2018
---

To help with this, we have partnered with the Edinburgh Convention
Bureau to set aside a number of hotel rooms which are reserved for
EuroPython attendees. These rooms will be held reserved until a few
weeks before the conference and are also available with a free
cancellation option.

The Edinburgh Convention Bureau has setup the following website for
booking rooms from this allocation:

* EuroPython 2018 Hotel Booking Website *
https://cabsedinburgh.eventsair.com/QuickEventWebsitePortal/europython-2018/home-page
(run by the Edinburgh Convention Bureau)


Update on EuroPython 2018
-

Meanwhile, we wanted to give you an update of where we are with the
conference organization:

We are still working on getting everything setup for launching the
website, opening ticket sales and the Call for Proposals (CFP).

This year the EuroPython Society (EPS) will be running the ticket
sales, rather than a local organization and we are facing some
challenges related to VAT taxes, which are taking longer to sort out
than expected.

This is the main reason for the delay you are seeing, but we’re
getting there.


Enjoy,
--
EuroPython 2018 Team
https://ep2018.europython.eu/
https://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/971716086445027328
Thanks.

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


[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread INADA Naoki

INADA Naoki  added the comment:

> 1. ABCMeta.register() accepts types only.

Yes.  While ABC.register() and issubclass() have different users (e.g. 
ABC.register() will be used by  framework author, and issubclass will be used 
by framework users), it's positive reason to remove non-type support.

> 2. ABCMeta.__subclasscheck__ implicitly requires its arguments to support 
> weak references (regardless of whether __subclasshook__ is called or not). 
> This requirement alone doesn't make sense, so it seems to be an exposed 
> implementation detail stemming from the fact that non-types were not intended 
> to be supported.

Isn't it just a limitation?
Most Python-implemented objects supports weakref. I don't think "requiring 
weakref support implies it must be type object".


> 3. Some ABC users already expect that the argument of __subclasshook__ is a 
> type (see the example with collections.abc.Reversible by OP).

What "by OP" means?
I can't find `if not issubclass(cls, type): raise TypeError` in Reversible 
implementation.
They do duck-typing, same to ABC.


> 4. Attempting to support arbitrary arguments in ABC.__subclasscheck__ (by 
> returning False instead of raising TypeError or worse) will not solve any 
> 'issubclass' inconsistencies. 'issubclass' is fundamentally "fragmented": 
> issubclass(x, y) may return True/False while issubclass(x, z) may raise 
> TypeError, depending on __subclasscheck__ implementation.

Yes, as I commented above.

> It may be too late to impose stricter requirements for the first argument of 
> issubclass because 'typing' module relies on the support of non-types there.

Of course.


Personally speaking, I dislike magics including ABC, __subclasscheck__, 
overwriting __class__ with dummy object.  So I'm OK to limit the ability of it.

But I don't know much about how mages use ABC.  I need mages comment before 
merging the pull request.

BTW, do you think it should be backported to 3.7, or even 3.6?
Can 
https://github.com/python/cpython/commit/fc7df0e664198cb05cafd972f190a18ca422989c
 be reverted?

--

___
Python tracker 

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



EuroPython 2018: Our conference logo

2018-03-08 Thread M.-A. Lemburg
After intense work with our designer, we are happy to present the logo
for the EuroPython 2018 conference:

https://blog.europython.eu/post/171656128512/europython-2018-our-conference-logo

The colors and patterns are a play on Scottish kilts, referring to the
location, and a theatre curtain, representing the many presentations
we’ll have at the conference.

We hope you like it as much as we do.


Enjoy,
--
EuroPython 2018 Team
https://ep2018.europython.eu/
https://www.europython-society.org/


PS: Please forward or retweet to help us reach all interested parties:
https://twitter.com/europython/status/971716219232575488
Thanks.

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


Re: socket: Did I find a bug?

2018-03-08 Thread INADA Naoki
https://mail.python.org/pipermail/python-list/2016-February/703154.html

On Thu, Mar 8, 2018 at 8:09 PM, Antoon Pardon  wrote:
> This is on a debian 9 box python 2.7.13
>
> My interpretation is that a timeout exception is thrown and that the
> args attribute of such an exception is an empty tuple which then causes
> an IndexError in line 482 of module /usr/lib/python2.7/socket.py. Does
> that soundplausible?
>
> Here is the traceback:
>
> Traceback (most recent call last):
>   File "/usr/local/lib/python-apps/rmtdump/pymain.py", line 101, in main
> Exit_Nr = process(sys.argv)
>   File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 249, in program
> process(path)
>   File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 184, in process
> of = rmt.open(rpj(rmt5lcl(rt), archive), "wb")
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 211, in open
> return ftpfile(ftp, fn, mode, True)
>   File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 70, in __init__
> self.cnct =  self.ftp.transfercmd("%s %s" % (cmd, rfn))
>   File "/usr/lib/python2.7/ftplib.py", line 376, in transfercmd
> return self.ntransfercmd(cmd, rest)[0]
>   File "/usr/lib/python2.7/ftplib.py", line 710, in ntransfercmd
> conn, size = FTP.ntransfercmd(self, cmd, rest)
>   File "/usr/lib/python2.7/ftplib.py", line 339, in ntransfercmd
> resp = self.sendcmd(cmd)
>   File "/usr/lib/python2.7/ftplib.py", line 249, in sendcmd
> return self.getresp()
>   File "/usr/lib/python2.7/ftplib.py", line 215, in getresp
> resp = self.getmultiline()
>   File "/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
> line = self.getline()
>   File "/usr/lib/python2.7/ftplib.py", line 186, in getline
> line = self.file.readline(self.maxline + 1)
>   File "/usr/lib/python2.7/socket.py", line 482, in readline
> if e.args[0] == EINTR:
> IndexError: tuple index out of range
> Locals by frame, innermost last
>
> Frame main in /usr/local/lib/python-apps/rmtdump/pymain.py at line 119
>backtrace = 
>  fun = 
>   pn = 'rmtdump'
>  process = 
>
> Frame program in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 281
>  ErrInfo = IndexError('tuple index out of range',)
>  aborted = True
> argv = ['/usr/local/sbin/rmtdump']
> path = '/home/antoon'
>
> Frame process in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 208
>  ErrInfo = IndexError('tuple index out of range',)
> b_rt = 
> '/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be'
>   backupflag = 'rwx'
>  backupstamp = 1520450190
>   checkstamp = 1519846075
>   cleanstamp = 1
> dirs = ['Archives-1.sbd', 'INBOX.sbd']
>  entries = ['@TODO.msf', 'Archives-1.msf', 'Archives-1.sbd', 
> 'Archives.msf', 'Drafts-1.msf', 'Drafts.msf', 'INBOX', ...
>entry = 'msgFilterRules.dat'
>file_info = posix.stat_result(st_mode=33188, st_ino=10365097, 
> st_dev=2058, st_nlink=1, st_uid=1000, st_gid=1000, st_ ...
> fileinfo = posix.stat_result(st_mode=33152, st_ino=10621705, 
> st_dev=2058, st_nlink=1, st_uid=1000, st_gid=1000, st_ ...
>files = ['Junk.msf', 'Drafts.msf', 'filterlog.html', 
> 'Drafts-1.msf', 'Archives.msf', 'junklog.html', 'msgFilterR ...
>filestamp = 1463826952.531162
> fqpn = 
> '/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/msgFilterRules.dat'
>   islink = 
>  ismount = 
> last = 1520450604.318512
> ls_stamp = ['+1520450190', '1519846075', '1', '0', '0']
>newfn = 
> 'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!2018-03-07@20_16_30-tbz'
>  now = 1520450549
>  nr_of_tries = 0
>   of = None
>oldfn = 
> 'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
> path = '/home/antoon'
>   rt = 
> '/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be'
> st_stamp = '+1520450190:1519846075:1'
>stamp = '1'
>start = 1520450604
>   tf = 
>   timefn = '!2018-03-07@20_16_30-tbz'
>tryal = 0
>   update = True
>
> Frame open in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 211
>   fn = 
> 'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
>  ftp = FTPS(ant...@pardon-sleeuwaegen.be@ftp.adrive.com)
> mode = 'wb'
> self = FTPS(ant...@pardon-sleeuwaegen.be@ftp.adrive.com)
>
> Frame __init__ in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 70
>bound = True
>   ch = 'b'
> 

[issue33024] asyncio.WriteTransport.set_write_buffer_limits orders its args unintuitively and inconsistently with its companion function's return value

2018-03-08 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

We cannot change the method signature without breaking backward compatibility. 
I doubt if we should do something with the issue.

--

___
Python tracker 

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



Re: Which part of the loop is it going through in this class frame?

2018-03-08 Thread Steven D'Aprano
On Wed, 07 Mar 2018 16:57:51 -0500, C W wrote:

> Hello,
> 
> I am new to OOP. I'm a bit confused about the following code.
> 
> class Clock(object):
> def __init__(self, time):
> self.time = time

Here you set the instance attribute "self.time".

> def print_time(self):
> time = '6:30'
> print(self.time)

Here you set the local variable "time", which is completely unrelated to 
the attribute "self.time".

If you are used to languages where "foo" inside a method is a short-cut 
for "self.foo" or "this.foo", Python does not do that. Local variables 
and instance attributes are distinct concepts, and Python keeps them 
distinct.


> How does line-by-line execution run inside a frame? 

There isn't actually line-by-line execution as such, although it can be 
very similar. Before the interpreter runs Python code, it compiles it to 
byte-code, and then runs the byte-code. A single line of source code 
could result in any number of lines of byte code, from zero to an 
unlimited number. 

> How does __init__
> work? I understand you must have __init__. 

You understand wrongly then :-)

It is normal and common to have an __init__ method, but it is not 
compulsory. If your class doesn't need one, you don't need to write it.

The __init__ method is the initialiser. Think of it as very similar to 
the constructor in some other languages, and for now the differences 
aren't important. The usual purpose of the __init__ method is to 
initialise the instance and set any attributes needed.

> Is it run before print_time(),

The __init__ method is called once, when the instance is first created. 
So the short answer is, yes, it will run before print_time(). But only 
once.

> if so, why don't I just set self.time = '6:30' instead of
> self.time = time?

Because then every instance will be set to 6:30, instead of letting you 
set each instance to a different time.



-- 
Steve

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


[issue33021] Some fstat() calls do not release the GIL, possibly hanging all threads

2018-03-08 Thread Nir Soffer

Nir Soffer  added the comment:

Python cannot protect raw file descriptor from bad multi-threaded
application. For example the application may close a file descriptor twice
which may lead to closing unrelated file descriptor created by another
thread just after it was closed, before the second close.

This issue affects all function using raw file descriptors, and we cannot
protect them with the GIL.

Even if fstat was not thread safe, we cannot protect it using the GIl
since this blocks the entire application until fstat returns.

--

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-08 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

I do not see any point in allowing non-types in ABCMeta.__subclasscheck__. 
Currently, ABCs are clearly not designed to support non-types:

1. ABCMeta.register() accepts types only.
2. ABCMeta.__subclasscheck__ implicitly requires its arguments to support weak 
references (regardless of whether __subclasshook__ is called or not). This 
requirement alone doesn't make sense, so it seems to be an exposed 
implementation detail stemming from the fact that non-types were not intended 
to be supported.
3. Some ABC users already expect that the argument of __subclasshook__ is a 
type (see the example with collections.abc.Reversible by OP).
4. Attempting to support arbitrary arguments in ABC.__subclasscheck__ (by 
returning False instead of raising TypeError or worse) will not solve any 
'issubclass' inconsistencies. 'issubclass' is fundamentally "fragmented": 
issubclass(x, y) may return True/False while issubclass(x, z) may raise 
TypeError, depending on __subclasscheck__ implementation. It may be too late to 
impose stricter requirements for the first argument of issubclass because 
'typing' module relies on the support of non-types there.

--

___
Python tracker 

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



socket: Did I find a bug?

2018-03-08 Thread Antoon Pardon
This is on a debian 9 box python 2.7.13

My interpretation is that a timeout exception is thrown and that the
args attribute of such an exception is an empty tuple which then causes
an IndexError in line 482 of module /usr/lib/python2.7/socket.py. Does
that soundplausible?

Here is the traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python-apps/rmtdump/pymain.py", line 101, in main
Exit_Nr = process(sys.argv)
  File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 249, in program
process(path)
  File "/usr/local/lib/python-apps/rmtdump/rmtdump.py", line 184, in process
of = rmt.open(rpj(rmt5lcl(rt), archive), "wb")
  File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 211, in open
return ftpfile(ftp, fn, mode, True)
  File "/usr/local/lib/python-apps/rmtdump/ftputil.py", line 70, in __init__
self.cnct =  self.ftp.transfercmd("%s %s" % (cmd, rfn))
  File "/usr/lib/python2.7/ftplib.py", line 376, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
  File "/usr/lib/python2.7/ftplib.py", line 710, in ntransfercmd
conn, size = FTP.ntransfercmd(self, cmd, rest)
  File "/usr/lib/python2.7/ftplib.py", line 339, in ntransfercmd
resp = self.sendcmd(cmd)
  File "/usr/lib/python2.7/ftplib.py", line 249, in sendcmd
return self.getresp()
  File "/usr/lib/python2.7/ftplib.py", line 215, in getresp
resp = self.getmultiline()
  File "/usr/lib/python2.7/ftplib.py", line 201, in getmultiline
line = self.getline()
  File "/usr/lib/python2.7/ftplib.py", line 186, in getline
line = self.file.readline(self.maxline + 1)
  File "/usr/lib/python2.7/socket.py", line 482, in readline
if e.args[0] == EINTR:
IndexError: tuple index out of range
Locals by frame, innermost last

Frame main in /usr/local/lib/python-apps/rmtdump/pymain.py at line 119
   backtrace = 
 fun = 
  pn = 'rmtdump'
 process = 

Frame program in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 281
 ErrInfo = IndexError('tuple index out of range',)
 aborted = True
argv = ['/usr/local/sbin/rmtdump']
path = '/home/antoon'

Frame process in /usr/local/lib/python-apps/rmtdump/rmtdump.py at line 208
 ErrInfo = IndexError('tuple index out of range',)
b_rt = 
'/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be'
  backupflag = 'rwx'
 backupstamp = 1520450190
  checkstamp = 1519846075
  cleanstamp = 1
dirs = ['Archives-1.sbd', 'INBOX.sbd']
 entries = ['@TODO.msf', 'Archives-1.msf', 'Archives-1.sbd', 
'Archives.msf', 'Drafts-1.msf', 'Drafts.msf', 'INBOX', ...
   entry = 'msgFilterRules.dat'
   file_info = posix.stat_result(st_mode=33188, st_ino=10365097, 
st_dev=2058, st_nlink=1, st_uid=1000, st_gid=1000, st_ ...
fileinfo = posix.stat_result(st_mode=33152, st_ino=10621705, 
st_dev=2058, st_nlink=1, st_uid=1000, st_gid=1000, st_ ...
   files = ['Junk.msf', 'Drafts.msf', 'filterlog.html', 
'Drafts-1.msf', 'Archives.msf', 'junklog.html', 'msgFilterR ...
   filestamp = 1463826952.531162
fqpn = 
'/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/msgFilterRules.dat'
  islink = 
 ismount = 
last = 1520450604.318512
ls_stamp = ['+1520450190', '1519846075', '1', '0', '0']
   newfn = 
'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!2018-03-07@20_16_30-tbz'
 now = 1520450549
 nr_of_tries = 0
  of = None
   oldfn = 
'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
path = '/home/antoon'
  rt = 
'/home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be'
st_stamp = '+1520450190:1519846075:1'
   stamp = '1'
   start = 1520450604
  tf = 
  timefn = '!2018-03-07@20_16_30-tbz'
   tryal = 0
  update = True

Frame open in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 211
  fn = 
'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
 ftp = FTPS(ant...@pardon-sleeuwaegen.be@ftp.adrive.com)
mode = 'wb'
self = FTPS(ant...@pardon-sleeuwaegen.be@ftp.adrive.com)

Frame __init__ in /usr/local/lib/python-apps/rmtdump/ftputil.py at line 70
   bound = True
  ch = 'b'
 cmd = 'STOR'
  cn = FTPS(ant...@pardon-sleeuwaegen.be@ftp.adrive.com)
   count = 1
mode = 'wb'
 rfn = 
'home/antoon/.icedove/clam9zaw.default/ImapMail/mail.priorweb.be/!ENTRY-tbz'
self = None

Frame transfercmd in /usr/lib/python2.7/ftplib.py at line 376
   

  1   2   >