Re: Pylint false positives

2018-08-14 Thread Frank Millman

"Frank Millman"  wrote in message news:pku0qd$ua5$1...@blaine.gmane.org...


Pylint is flagging a lot of lines as errors that I would consider to be 
acceptable.


I have an abstract class ClassA with a number of concrete sub-classes. 
ClassA has a method which invokes 'self.method_b()' which is defined 
separately on each sub-class. Pylint complains that "Instance of 'ClassA' 
has no  'method_b' member".




Thanks for all the responses. They have helped to clarify my thinking.

To summarise -

1. If I want my project to be taken seriously (which I do) I should define 
all methods in ClassA, with docstrings.


2. Pythons abc module, with its @abstractmethod decorator, seems the ideal 
fit for my situation, so I should use that.


Frank


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


help! PyQt4 and UTF-8

2018-08-14 Thread inhahe
I can display UTF-8 when I use wxPython:
--
import wx
app = wx.App()
s = 'testing\xf0\x9f\x98\x80'
frame = wx.Frame(None, wx.ID_ANY)
font = wx.Font("Arial")
textbox = wx.TextCtrl(frame, id=wx.ID_ANY)
textbox.SetFont(font)
textbox.WriteText(s)
frame.Show()
app.MainLoop()
--
But when I try the same thing with PyQt4..
--
from PyQt4 import QtGui
import sys
s = 'testing\xf0\x9f\x98\x80'
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
font = QtGui.QFont("Arial")
textbox = QtGui.QLineEdit(w)
textbox.setFont(font)
textbox.setText(s)
w.show()
sys.exit(app.exec_())
--
Instead of "testing" ("testing" with a smiley face after it, if you can't
see it in this message), I get "testingð" ("testing", then an o with some
kind of mark above it).

I tried replacing "s = 'testing\xf0\x9f\x98\x80'" with "s =
'testing\xf0\x9f\x98\x80'.decode('UTF-8')" in case PyQt takes Unicode
instead of UTF-8, but in that case I get "testing" and then a little square
after it (like the character isn't found in the font). If I copy it and
paste it here I get "testing" ("testing" with a smiley face after it,
like I want), so I guess displaying it in the font is the problem, but I
don't know why.. as you can see, both the wxPython and the PyQt examples
use "Arial." I've also tried "FixedSys Excelsior 3.01".

Python version: CPython 2.7.14
OS: Windows 10

thanks for any help
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34370] Tkinter scroll issues on macOS

2018-08-14 Thread Kevin Walzer


Kevin Walzer  added the comment:

I just committed http://core.tcl.tk/tk/info/26a029b4a88ff97f, which fixes the 
scrolling issue in Tk. Running the test scripts here indicate the behavior is 
now correct; clicking several pixels below the bottom part of the scroll button 
causes the scroll to jump, instead of smoothly scrolling. (One must click the 
scroll button directly for smooth scrolling, which is the expected behavior.) 
The fix involved removing support for a small scroll button variant, which was 
causing the confusion; by sticking with a single variant, the normal size 
scroller, the behavior is correct and consistent.

--

___
Python tracker 

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



[issue34410] Segfault/TimeoutError: itertools.tee of multiprocessing.pool.imap_unordered

2018-08-14 Thread Carlo Rosati


New submission from Carlo Rosati :

Hello, 

When I run the attached code, I encounter a segmentation fault.

Thanks,
Carlo

--
files: 3.py
messages: 323546
nosy: carlorosati
priority: normal
severity: normal
status: open
title: Segfault/TimeoutError: itertools.tee of 
multiprocessing.pool.imap_unordered
type: crash
versions: Python 2.7, Python 3.7
Added file: https://bugs.python.org/file47750/3.py

___
Python tracker 

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



[issue34392] Add sys.isinterned()

2018-08-14 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

Agreed it should be non-public, but can we please call it sys._is_interned()?

--
nosy: +barry

___
Python tracker 

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



[issue34409] Add a way to customize iteration over fields in asdict() for the nested dataclasses

2018-08-14 Thread mkurnikov


mkurnikov  added the comment:

from pprint import pprint
from typing import List, Any, Dict

import dataclasses
from dataclasses import field


def service_interface_dict_factory(obj: Any) -> Dict[str, Any]:
print(type(obj)) # <- type(obj) here is a list, but there's no way to 
understand whether it's a ServiceInterface or
# InputVar except for looking for the presence of certain keys which is not 
very convenient
return dict(obj)


@dataclasses.dataclass
class InputVar(object):
name: str
required: bool = False
options: Dict[str, Any] = field(default_factory=dict)


@dataclasses.dataclass
class ServiceInterface(object):
input: List[InputVar] = field(default_factory=list)


if __name__ == '__main__':
inputvar_inst = InputVar(name='myinput',
 required=False,
 options={'default': 'mytext'})
interface = ServiceInterface(input=[inputvar_inst])

outdict = dataclasses.asdict(interface, 
dict_factory=service_interface_dict_factory)
print('outdict', end=' ')
pprint(outdict)

# prints:
# outdict {'input': [{'name': 'myinput',
# 'options': {'default': 'mytext'},
# 'required': False}]}

# desirable output
# {'input': [{
# 'name': 'myinput',
# 'required': False,
# 'default': 'mytext'
# }]}
# "default" key moved to the root of the dictionary (inside list)

--

___
Python tracker 

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



Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
> You might try:
> from getopt import getopt
> or the (apparently newer):
> from optparse import OptionParser

Thanks Mike. My question was trying to make a distinction between Python 
options (flags that precede the script or module name) and arguments (the 
script specific values passed on the command line following the script's name).

Here's a description of the options I'm referring to:
https://docs.python.org/3/using/cmdline.html#generic-options
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
> If you run the script directly, by entering >script.py or clicking a script 
> icon or name in File Explorer, it runs python without python options *other 
> than those specified in environmental variables*.

Understood. I thought there might have been a way to pass Python option values 
via a single environment variable (something like PYTHONOPTIONS)  vs individual 
environment variables.

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


[issue34409] Add a way to customize iteration over fields in asdict() for the nested dataclasses

2018-08-14 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

___
Python tracker 

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



[issue34409] Add a way to customize iteration over fields in asdict() for the nested dataclasses

2018-08-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

Could you show some example dataclass instances? Also, show the output you get 
with asdict(), and show what output you'd like to get instead.

I'm not sure I understand it correctly from the description you've given.

Thanks!

--
nosy: +eric.smith
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue34409] Add a way to customize iteration over fields in asdict() for the nested dataclasses

2018-08-14 Thread mkurnikov


New submission from mkurnikov :

Suppose I have two dataclasses:

@dataclass
class NestedDataclass(object):
name: str
options: Dict[str, Any] = field(default_factory=dict)

@dataclass
class RootDataclass(object):
nested_list: List[NestedDataclass]

I want a dict under the key "options" to be merged in the NestedDataclass dict 
in the dataclasses.asdict(root_dcls_instance). 

For that, according to docs, I need to specify dict_factory= for 
dataclasses.asdict() function. 

The problem is that, according to the implementation, when this function 
"meets" dataclass, there's no way to customize how result dict will be built. 
Dataclass itself is never passed to the function. 

if _is_dataclass_instance(obj):
result = []
for f in fields(obj):
value = _asdict_inner(getattr(obj, f.name), dict_factory)
result.append((f.name, value))
return dict_factory(result)

Yes, I can catch "result" obj (what I did in the end):

def root_dataclass_dict_factory(obj):
if isinstance(obj, list):
dataclass_dict = dict(obj)
if 'options' in dataclass_dict:
dataclass_dict.update(dataclass_dict.pop('options'))

return dict(obj)

The problem is that type of the dataclass is lost for the list, and if by any 
chance later I'll have "options" key in the RootDataclass, there's no way for 
me to distinguish between them cleanly. 

Other solution is to iterate over the RootDataclass dictionary, follow the path 
to the NestedDataclass and change dictionary there, but it even uglier. 

Would be nice to be able to somehow hook into the field traversal of the 
dataclass instance.

--
components: Library (Lib)
messages: 323542
nosy: mkurnikov
priority: normal
severity: normal
status: open
title: Add a way to customize iteration over fields in asdict() for the nested 
dataclasses
type: enhancement
versions: Python 3.6

___
Python tracker 

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



Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Michael F. Stemper
On 2018-08-14 16:45, Malcolm Greene wrote:
> When you run a script via "python3 script.py" you can include command
> line options like -b, -B, -O, -OO, etc between the "python3" interpreter
> reference and the script.py file, eg. "python3 -b -B -O -OO script.py".
> When you create a script that is executable directly, eg. script.py with
> execution bit set on Linux or on Windows where the .py file extension is
> associated with a specific Python executable, there doesn't appear to be
> a way to pass command line options to the script. In this later case,
> how can I pass my script command line options without having these
> options confused with command line arguments?

You might try:
from getopt import getopt
or the (apparently newer):
from optparse import OptionParser

These appear to both be deprecated in favor of argparse. I haven't made
the switch myself because argparse appears (upon a cursory reading of
the documentation) to muddle the difference between options and
arguments.

-- 
Michael F. Stemper
Indians scattered on dawn's highway bleeding;
Ghosts crowd the young child's fragile eggshell mind.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Terry Reedy

On 8/14/2018 5:45 PM, Malcolm Greene wrote:

When you run a script via "python3 script.py" you can include command
line options like -b, -B, -O, -OO, etc between the "python3" interpreter
reference and the script.py file, eg. "python3 -b -B -O -OO script.py".


More generally,

python  script.py 

[issue32485] Multiprocessing dict sharing between forked processes

2018-08-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue33930] Segfault with deep recursion into object().__dir__

2018-08-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

2018-08-14 Thread Malcolm Greene
When you run a script via "python3 script.py" you can include command
line options like -b, -B, -O, -OO, etc between the "python3" interpreter
reference and the script.py file, eg. "python3 -b -B -O -OO script.py".
When you create a script that is executable directly, eg. script.py with
execution bit set on Linux or on Windows where the .py file extension is
associated with a specific Python executable, there doesn't appear to be
a way to pass command line options to the script. In this later case,
how can I pass my script command line options without having these
options confused with command line arguments?
Thank you,
Malcolm
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pylint false positives

2018-08-14 Thread Terry Reedy

On 8/14/2018 5:05 AM, Thomas Jollans wrote:

On 2018-08-14 09:38, Frank Millman wrote:

Hi all

Pylint is flagging a lot of lines as errors that I would consider to be
acceptable.

I have an abstract class ClassA with a number of concrete sub-classes.
ClassA has a method which invokes 'self.method_b()' which is defined
separately on each sub-class. Pylint complains that "Instance of
'ClassA' has no  'method_b' member".

First question - as a matter of style, is Pylint correct? If so, I could
define 'method_b' in ClassA and raise NotImplementedError. Is this
considered more pythonic? The downside is that I have quite a few of
them, so it would add some clutter.


If I were reading you class, I would like to see all methods defined 
there.  If you went the old NotImplemented(Error) route, you could avoid 
cluttter with


method_c = method_d = method_e = method_b

but I would also want docstrings.  At that point, I would consider 
abstractmethod.  But I have not used that, not seen an stdlib class that 
does.



I wouldn't say it's unpythonic per se, but if your ClassA is logically
an abstract base class that requires certain methods to be implemented
in subclasses, then it's probably clearer to use Python's abc [1]
facilities, and declare your abstract methods as actual abstractmethods.

[1]: https://docs.python.org/3/library/abc.html

i.e.

from abc import ABC, abstractmethod
class ClassA(ABC):
 def do_stuff(self):
 return self.method_b(42)**3

 @abstractmethod
 def method_b(self, answer):
 """
 This is a great place to put a docstring
 """

You *can* raise NotImplementedError in your abstractmethods, but I don't
think it's really necessary. You need a statement in the method body of
course, but since you're going to put a docstring there anyway (right?),
that's already taken care of.

-- Thomas



Second question - if my present code is not unpythonic, is there an easy
way to suppress the error messages, without disabling 'no-member'
altogether?



--
Terry Jan Reedy


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


[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-14 Thread Tim Peters


Tim Peters  added the comment:

Bah - the relevant thing to assert is really

assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) <= (size_t)PY_SSIZE_T_MAX);

C sucks ;-)

--

___
Python tracker 

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



[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-14 Thread Tim Peters


Tim Peters  added the comment:

I agree there's pointless code now, but don't understand why the patch replaces 
it with mysterious asserts.  For example, what's the point of this?

assert(Py_SIZE(a) <= PY_SSIZE_T_MAX / sizeof(PyObject*));
assert(Py_SIZE(b) <= PY_SSIZE_T_MAX / sizeof(PyObject*));

The invariant that needs to be maintained is that the number of elements is no 
larger than PY_SSIZE_T_MAX, so the _relevant_ thing to assert is:

assert(Py_SIZE(a) + Py_SIZE(b) <= PY_SSIZE_T_MAX);

That in turn cries out for an explanation of why it must be true.  The asserts 
actually in the patch are part of that explanation, but on their own appear to 
be coming from Mars.  They're missing the conclusion, and rely on further 
unstated subtleties.

Suggest adding a comment where the structs are defined, like:

"""
Note:  Python's memory allocators return at most PY_SSIZE_T_MAX bytes.  
Therefore a vector of PyObject* can contain no more than PY_SSIZE_T_MAX / 
sizeof(PyObject*) elements.  In particular, a PyObject* consumes at least 2 
bytes, so a vector can contain no more than PY_SSIZE_T_MAX / 2 elements.  Code 
freely relies on that.

#if SIZEOF_VOID_P < 2
#   error "size of pointer less than 2 bytes?!"
#endif
"""

--

___
Python tracker 

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



[issue34392] Add sys.isinterned()

2018-08-14 Thread Brett Cannon


Brett Cannon  added the comment:

I agree with Christian; this is an implementation detail so it should be 
flagged as private/internal somehow.

--
nosy: +brett.cannon

___
Python tracker 

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



Re: Good reason not to obfuscate URLs (was: Fishing from PyPI ?)

2018-08-14 Thread Ian Kelly
On Tue, Aug 14, 2018 at 1:41 PM Peter J. Holzer  wrote:
>
> On 2018-08-08 05:18:21 +, Gilmeh Serda wrote:
> > And if you read email in blasted HTML, chances are they also have an
> > image that they serve to you on their "beautiful" page you receive, an
> > image whose link which may or may not be equally personalized, and more
> > often than not has its origin on the spammer's server. in which case they
> > also know *exactly when* you opened the email. If at all.
> >
> > Oh, and thank the developer of Outlook, and similarly badly constructed
> > programs, for that preview pane. It's really helpful for all the spammers.
>
> I hate to defend Outlook (which I think is a really bad MUA), but it
> gets this one right: Properly configured[1] it does NOT load inline images
> from web-pages, so you can't be tracked simply by opening a mail.
>
> hp
>
> [1] Not sure whether this is the default or whether our admins
> configured it that way.

Same for Gmail, I believe. It doesn't show the external images unless
you explicitly click something to load them. I would expect any
competent MUA of at least the past decade to do the same.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34408] possible null pointer dereference in pystate.c

2018-08-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue34408] possible null pointer dereference in pystate.c

2018-08-14 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

The problem occurs here:

https://github.com/python/cpython/blob/master/Python/pystate.c#L185

If _PyRuntime.interpreters.next_id < 0 then interp is set to NULL and it will 
be dereferenced later:

interp

--
components: Interpreter Core
messages: 323538
nosy: pablogsal
priority: normal
severity: normal
status: open
title: possible null pointer dereference in pystate.c
type: crash
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: Good reason not to obfuscate URLs (was: Fishing from PyPI ?)

2018-08-14 Thread Peter J. Holzer
On 2018-08-08 05:18:21 +, Gilmeh Serda wrote:
> And if you read email in blasted HTML, chances are they also have an 
> image that they serve to you on their "beautiful" page you receive, an 
> image whose link which may or may not be equally personalized, and more 
> often than not has its origin on the spammer's server. in which case they 
> also know *exactly when* you opened the email. If at all.
> 
> Oh, and thank the developer of Outlook, and similarly badly constructed 
> programs, for that preview pane. It's really helpful for all the spammers.

I hate to defend Outlook (which I think is a really bad MUA), but it
gets this one right: Properly configured[1] it does NOT load inline images
from web-pages, so you can't be tracked simply by opening a mail.

hp

[1] Not sure whether this is the default or whether our admins
configured it that way.

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34381] Make tests with outbound connection optional

2018-08-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

You can run all the tests except the ones that require external network (like 
SSL for sockets) using:

./python -m test -uall,-network

or you can exclude tests using the -x flag.

--

___
Python tracker 

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



[issue34381] Make tests with outbound connection optional

2018-08-14 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
Removed message: https://bugs.python.org/msg323536

___
Python tracker 

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



[issue34381] Make tests with outbound connection optional

2018-08-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

You can run all the tests except the ones that require external network (like 
SSL for sockets) using:

./python -m test -uall,network

or you can exclude tests using the -x flag.

--
nosy: +pablogsal

___
Python tracker 

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



[issue34406] Typo in documentation

2018-08-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am not sure how people usually refer to the Windows register but this seems 
that the current line is differentiating from the path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

and the value

LongPathsEnabled

--

___
Python tracker 

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



[issue34406] Typo in documentation

2018-08-14 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Isn't this saying that LongPathsEnabled is a value on the path 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem?

--
nosy: +pablogsal

___
Python tracker 

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



[issue11192] test_socket error on AIX

2018-08-14 Thread Michael Felt


Michael Felt  added the comment:

The original error reported was fixed by AIX - in AIX 6.1.

It will remain unresolved in AIX 5.3.

There are currently two other errors in test_socket.

FAIL: test_getnameinfo_ipv6_scopeid_symbolic 
(test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File "/data/prj/python/git/python3-3.7/Lib/test/test_socket.py", line 1649, 
in test_getnameinfo_ipv6_scopeid_symbolic
self.assertEqual(nameinfo, ('ff02::1de:c0:face:8d%' + test_interface, 
'1234'))
AssertionError: Tuples differ: ('ff02::1de:c0:face:8d', '1234') != 
('ff02::1de:c0:face:8d%en0', '1234')

First differing element 0:
'ff02::1de:c0:face:8d'
'ff02::1de:c0:face:8d%en0'

- ('ff02::1de:c0:face:8d', '1234')
+ ('ff02::1de:c0:face:8d%en0', '1234')
?   

I assume the capital D in the argument in the test:
sockaddr = ('ff02::1de:c0:face:8D', 1234, 0, ifindex)  # Note capital 
letter `D`.

is meant to trigger getting the IPv6 zoneinfo based on ifindex.

AIX does have a routine to strip zoneinfo off an IPv6 address, but the 
getnameinfo() and getaddrinfo() do not support this.

I can create a new issue specifically for IPv6 zone id issue, or I can add a PR 
here. 

Please advise (the PR is merely adding "skipUnless" logic to test_socket.py.

ERROR: test_getaddrinfo_ipv6_scopeid_symbolic

--

___
Python tracker 

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



[issue34356] Add support for args and kwargs in logging.conf

2018-08-14 Thread Vinay Sajip


Vinay Sajip  added the comment:

There aren't any changes planned to the fileConfig code, other than bug fixes. 
If you need improved functionality, you can use dictConfig, which already 
supports improved configuration features when compared to fileConfig.

The fileConfig API was present when the logging package was first added to 
Python, and dictConfig is a later enhancement (PEP 391).

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

___
Python tracker 

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



[issue19050] [Windows] fflush called on pointer to potentially closed file

2018-08-14 Thread ppperry


Change by ppperry :


--
title: [Python 2, Windows] fflush called on pointer to potentially closed file 
-> [Windows] fflush called on pointer to potentially closed file

___
Python tracker 

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



[issue34407] datetime.time.isoformat function has inconsistent behavior with timezone

2018-08-14 Thread Maksym Shalenyi (Enkidulan)


New submission from Maksym Shalenyi (Enkidulan) :

In some cases datetime.time.isoformat shows timezone info, but in some does 
not. Consider the example below.

import datetime
import pytz

t = dict(hour=12, minute=31, second=21, microsecond=213456)

# `datetime.time.isoformat` has inconsistent behavior. Some of printed has 
timezone, but others does not.
print(datetime.time(tzinfo=pytz.timezone('Asia/Seoul'), **t).isoformat())
print(datetime.time(tzinfo=pytz.timezone('Etc/GMT-9'), **t).isoformat())
print(datetime.time(tzinfo=pytz.timezone('Australia/Sydney'), **t).isoformat())
print(datetime.time(tzinfo=pytz.timezone('Etc/UTC'), **t).isoformat())
# output:
# 12:31:21.213456
# 12:31:21.213456+09:00
# 12:31:21.213456
# 12:31:21.213456+00:00



# `datetime.time.isoformat` is inconsistent with `datetime.datetime.isoformat`. 
`datetime` objects always shows tz information when tz is present.
d = dict(year=2018, month=2, day=2, **t)
print(datetime.datetime(tzinfo=pytz.timezone('Asia/Seoul'), **d).isoformat())
print(datetime.datetime(tzinfo=pytz.timezone('Etc/GMT-9'), **d).isoformat())
print(datetime.datetime(tzinfo=pytz.timezone('Australia/Sydney'), 
**d).isoformat())
print(datetime.datetime(tzinfo=pytz.timezone('Etc/UTC'), **d).isoformat())
# output:
# 2018-02-02T12:31:21.213456+08:28
# 2018-02-02T12:31:21.213456+09:00
# 2018-02-02T12:31:21.213456+10:05
# 2018-02-02T12:31:21.213456+00:00

--
components: ctypes
messages: 323531
nosy: Maksym Shalenyi (Enkidulan)
priority: normal
severity: normal
status: open
title: datetime.time.isoformat function has inconsistent behavior with timezone
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-08-14 Thread Steve Dower


Steve Dower  added the comment:

I've pushed the new sources for the Windows build, and am about to do the new 
binaries.

If someone else gets to updating the references in the CPython repo before I 
do, that's fine by me.

--

___
Python tracker 

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



[issue34398] Docs search does not index glossary

2018-08-14 Thread Jonathan Fine


Jonathan Fine  added the comment:

Good discovery. The glossary uses the RST glossary directive.
https://github.com/python/cpython/blob/master/Doc/glossary.rst

The Sphinx docs have a glossary, which is indexed by its search.
http://www.sphinx-doc.org/en/master/search.html?q=domain

So maybe Sphinx already has the functionality we require. Perhaps it's simply a 
matter of configuring the Python docs to use it. (This is optimism.)

--
status: pending -> open

___
Python tracker 

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



[issue34398] Docs search does not index glossary

2018-08-14 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

Hmm the search is built-in functionality in Sphinx, and I don't think we have 
any way to control or customize that.

--
nosy: +Mariatta
resolution:  -> third party
status: open -> pending
versions:  -Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



Re: Pylint false positives

2018-08-14 Thread Jon Ribbens
On 2018-08-14, Steven D'Aprano  wrote:
> If there really are a lot of such missing methods, I'd consider writing 
> something like this:
>
> class A:
> def __init__(self, ...):
> ...
>
> # === process abstract methods en masse ===
> for name in "method_a method_b method_c method_d".split():
> @abstractmethod
> def inner(self):
> raise NotImplementedError
> inner.__name__ = name
> # This is okay, writing to locals works inside the class body.
> locals()[name] = inner
>
> del inner, name  # Clean up the class namespace.

You have a peculiar idea of "good style"...

> although to be honest I'm not sure if that would be enough to stop PyLint 
> from complaining.

No - if you think about it, there's no way Pylint could possibly know
that the above class has methods method_a, method_b, etc. It also
doesn't like the `del inner, name` because theoretically neither of
those names might be defined, if the loop executed zero times.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: >< swap operator

2018-08-14 Thread Brian Oney via Python-list
On Tue, 2018-08-14 at 10:55 -0400, Dennis Lee Bieber wrote:
> On Tue, 14 Aug 2018 06:18:41 -0700 (PDT), skybuck2...@hotmail.com declaimed
> the following:
> 
> > On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote:
> > > On 13/08/2018 21:54, skybuck2...@hotmail.com wrote:
> > > > I just had a funny idea how to implement a swap operator for types:
> > > > 
> > > > A >< B
> > > > 
> > > > would mean swap A and B.
> > > 
> > > I think that:
> > > 
> > > a, b = b, a
> > > 
> > > is pretty enough
> > 
> > LOL.
> > 
> > A >< B is shorter !
> > 
> 
>   But is specific to swapping just two entities...
> 
>   c, a, b = a, b, c
> 
> moves three entities at once -- and can be expanded for more.
> 
> > > > a = 1
> > > > b = 2
> > > > c = "confusion"
> > > > 
> > > > c, a, b = a, b, c
> > > > print a
> 
> 2
> > > > print b
> 
> confusion
> > > > print c
> 
> 1
Indeed, that is elegant.  It doesn't take a special knowledge of syntax, for 
good guessers. It also doesn't look like two male variables peeing on each 
others feet.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34406] Typo in documentation

2018-08-14 Thread Alisue Lambda


Change by Alisue Lambda :


--
title: Type in documentation -> Typo in documentation

___
Python tracker 

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



[issue34406] Type in documentation

2018-08-14 Thread Alisue Lambda


New submission from Alisue Lambda :

https://docs.python.org/3.8/using/windows.html#removing-the-max-path-limitation

Current
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem@LongPathsEnabled

Should be
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled

--
assignee: docs@python
components: Documentation
messages: 323527
nosy: Alisue Lambda, docs@python
priority: normal
severity: normal
status: open
title: Type in documentation
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



[issue32947] Support OpenSSL 1.1.1

2018-08-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 2a4ee8aa01d61b6a9c8e9c65c211e61bdb471826 by Christian Heimes in 
branch '3.6':
bpo-32947: Fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-8761)
https://github.com/python/cpython/commit/2a4ee8aa01d61b6a9c8e9c65c211e61bdb471826


--

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 1f34aece28d143edb94ca202e661364ca394dc8c by Christian Heimes in 
branch '2.7':
[2.7] bpo-34399: 2048 bits RSA keys and DH params (GH-8762) (GH-8765)
https://github.com/python/cpython/commit/1f34aece28d143edb94ca202e661364ca394dc8c


--

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset e3228a3f44e382b6cdd2b5e001b651347013a7d3 by Christian Heimes 
(Miss Islington (bot)) in branch '3.7':
bpo-34399: 2048 bits RSA keys and DH params (GH-8762) (GH-8763)
https://github.com/python/cpython/commit/e3228a3f44e382b6cdd2b5e001b651347013a7d3


--

___
Python tracker 

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



[issue34390] arparse.ArgumentParser misparses list arguments followed by undefined arguments

2018-08-14 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34404] test_time incorrectly defined

2018-08-14 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

The proper format for int < 0 must be "%05d".

--

___
Python tracker 

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



[issue34393] json.dumps - allow compression

2018-08-14 Thread liad

liad  added the comment:

I'm sure I will find a work-around.
I posted it for other who will face the same issue as me.
There are many who uses cloud storage but not many work with PB size files. 
This will likely to change in the near future as more and more company start to 
process huge amount of data.

I'm not sure what you mean by designing an API. I think you sale it up for no 
need. It simply add of optional parameter which will trigger compression of 
gzip. That's it. Nothing sophisticated. 

Something like:

json.dumps(data, outfile, sort_keys=True,compression='gzip')

compression - Optional. A string representing the compression to use in the 
output. Allowed values are ‘gzip’.

--

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-08-14 Thread Christian Heimes


New submission from Christian Heimes :

1.0.2p and 1.1.0i were released today. Please update the Windows and macOS 
installers.

--
components: Windows, macOS
messages: 323521
nosy: christian.heimes, ned.deily, paul.moore, ronaldoussoren, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Upgrade to OpenSSL 1.1.0i / 1.0.2p
type: security
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Pylint false positives

2018-08-14 Thread Steven D'Aprano
On Tue, 14 Aug 2018 10:58:17 +0200, Frank Millman wrote:

>> > I have an abstract class ClassA with a number of concrete
>> > sub-classes. ClassA has a method which invokes 'self.method_b()'
>> > which is defined separately on each sub-class. Pylint complains that
>> > "Instance of 'ClassA' has no  'method_b' member".
[...]

> I do mean a lot of methods, not classes. I don't have any problem adding
> the lines. It is just that, before I starting using pylint, it had not
> occurred to me that there was any problem with my approach. If an
> experienced python programmer was reviewing my code, would they flag it
> as 'bad style'?

*shrug*

I wouldn't necessarily call it *bad*, but perhaps *not-quite good* style.

I think its fine for a small projects and quick scripts, especially if 
they're written and maintained by a single person for their own use. 
Perhaps not so much for large projects intended for long-term use with 
continual development.

If there really are a lot of such missing methods, I'd consider writing 
something like this:

class A:
def __init__(self, ...):
...

# === process abstract methods en masse ===
for name in "method_a method_b method_c method_d".split():
@abstractmethod
def inner(self):
raise NotImplementedError
inner.__name__ = name
# This is okay, writing to locals works inside the class body.
locals()[name] = inner

del inner, name  # Clean up the class namespace.

def concrete_method_a(self):
...


although to be honest I'm not sure if that would be enough to stop PyLint 
from complaining.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue34393] json.dumps - allow compression

2018-08-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

If you really want to see this added to Python, then I suggest you put together 
a proposal on what the API would be, what options you would or wouldn't 
support, and post that on python-ideas. But I'll warn you that your chances of 
success are low.

Your better chance of success is to write a wrapper around json and whatever 
compression library you want to use, and post that to PyPI to see if it gets 
traction. I believe you can do what you want without a temporary disk file.

--

___
Python tracker 

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



[issue34404] test_time incorrectly defined

2018-08-14 Thread Michael Osipov


New submission from Michael Osipov <1983-01...@gmx.net>:

I see a test failure on HP-UX:
> test_negative (test.test_time.TestStrftime4dyear) ... FAIL
> ==
> FAIL: test_negative (test.test_time.TestStrftime4dyear)
> --
> Traceback (most recent call last):
>   File "/var/osipovmi/cpython/Lib/test/test_time.py", line 687, in 
> test_negative
> return super().test_negative()
>   File "/var/osipovmi/cpython/Lib/test/test_time.py", line 713, in 
> test_negative
> self.assertEqual(self.yearstr(-1), self._format % -1)
> AssertionError: '-0001' != '-001'
> - -0001
> ?  -
> + -001

The bug is in the test class, not cause by HP-UX.
Lib/test/test_time.py:713 says "self.assertEqual(self.yearstr(-1), self._format 
% -1)" where self._format is set in line 654 to "_format = '%04d'" because
> Python 3.7.0+ (heads/3.7-dirty:ea8835fb30, Aug 14 2018, 14:44:19) [C] on 
> hp-ux11
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import time
> >>> time.strftime('%Y', (1,) + (0,) * 8)
> '0001'

Unfortunately, the zero padding in printf() applies to the entire string 
length. So
> >>> "%+04d" % -1
> '-001'

on HP-UX, Linux and FreeBSD.

The format string must add an additional zero for negative numbers.

--
components: Tests
messages: 323519
nosy: michael-o
priority: normal
severity: normal
status: open
title: test_time incorrectly defined
type: behavior
versions: Python 3.7

___
Python tracker 

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



Re: >< swap operator

2018-08-14 Thread Marko Rauhamaa
skybuck2...@hotmail.com:
> On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote:
>> On 13/08/2018 21:54, skybuck2...@hotmail.com wrote:
>> > I just had a funny idea how to implement a swap operator for types:
>> > 
>> > A >< B
>> > 
>> > would mean swap A and B.
>> 
>> I think that:
>> 
>> a, b = b, a
>> 
>> is pretty enough
>
> LOL.
>
> A >< B is shorter !

Don't forget the

   (A >:< B)

operator:

   def fib(n):
   curr = prev = 1
   for _ in range(n):
   (curr >:< prev) += prev
   return curr

Obviously, we see immediately the need for the Pythonic improvement:

   def fib(n):
   curr = prev = 1
   for _ in range(n):
   curr >+=< prev
   return curr


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


Re: >< swap operator

2018-08-14 Thread skybuck2000
On Monday, August 13, 2018 at 10:01:37 PM UTC+2, Léo El Amri wrote:
> On 13/08/2018 21:54, skybuck2...@hotmail.com wrote:
> > I just had a funny idea how to implement a swap operator for types:
> > 
> > A >< B
> > 
> > would mean swap A and B.
> 
> I think that:
> 
> a, b = b, a
> 
> is pretty enough

LOL.

A >< B is shorter !

And PPPython is all about writing short and lazy code ! =D

(>< reminds me of XOR swap ;))

Bye,
  Skybuck ;)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8242

___
Python tracker 

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



[issue33451] Start pyc file lock the file

2018-08-14 Thread Berker Peksag


Berker Peksag  added the comment:

All PRs have been merged (commit message from the 3.6 branch doesn't listed 
here but PR 7889 has been merged in 
https://github.com/python/cpython/commit/8f8ad2c38237caf5ee48f690289e8c811d245455)
 Closing this as 'fixed'. Please reopen if this issue needs to stay open.

--
nosy: +berker.peksag
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue34393] json.dumps - allow compression

2018-08-14 Thread liad


liad  added the comment:

True there are endless versions of compression just like there are endless 
version of file formats. Still there are some build-ins like conversion from 
string to json. For example you don't support of json to orc file. Same 
argument could have been raise here : how would we choose which conversions to 
also? Still a choice has been made and some basic conversion behavior is 
supported.

You are claiming that it's all or nothing which I don't think is the right 
approach.

Many are now moving their storage into cloud platforms. The storage is as it 
sound - storage. It doesn't offer any programming service what you stream is 
what you will have. Streaming huge files without compression = bleeding money 
for no reason. Saving the files to disk, compress them and then upload them 
might be very slow and also the idea is having machine with big memory and low 
storage - if you have to save huge files localy you'll also need big storage 
which costs more money.

Regarding google there is a pending request for who chooses to use 
GoogleCloudPlatform package but not all use that. 

https://github.com/GoogleCloudPlatform/google-cloud-python/issues/5791

Not to mention that there are dozes of other service providers. So even if 
Google will support it - this doesn't give answer to storage service providers 

I still claim that this is a basic legit request and can be handled by the 
json.dump() function.

gzip is fine. It also supported by pandas extension and is well known.

--

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8241

___
Python tracker 

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



[issue34403] test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions

2018-08-14 Thread Michael Osipov


New submission from Michael Osipov <1983-01...@gmx.net>:

Running from 3.7 branch on HP-UX 11.31 ia64, 32 bit, big endian.
The test output is:
> Re-running failed tests in verbose mode
> Re-running test 'test_utf8_mode' in verbose mode
> test_cmd_line (test.test_utf8_mode.UTF8ModeTests) ... FAIL
> test_env_var (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_filesystemencoding (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_io (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_io_encoding (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_locale_getpreferredencoding (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_optim_level (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_posix_locale (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_stdio (test.test_utf8_mode.UTF8ModeTests) ... ok
> test_xoption (test.test_utf8_mode.UTF8ModeTests) ... ok
> 
> ==
> FAIL: test_cmd_line (test.test_utf8_mode.UTF8ModeTests)
> --
> Traceback (most recent call last):
>   File "/var/osipovmi/cpython/Lib/test/test_utf8_mode.py", line 230, in 
> test_cmd_line
> check('utf8=0', [c_arg], LC_ALL='C')
>   File "/var/osipovmi/cpython/Lib/test/test_utf8_mode.py", line 223, in check
> self.assertEqual(args, ascii(expected), out)
> AssertionError: "['h\\xc3\\xa9\\xe2\\x82\\xac']" != 
> "['h\\udcc3\\udca9\\udce2\\udc82\\udcac']"
> - ['h\xc3\xa9\xe2\x82\xac']
> + ['h\udcc3\udca9\udce2\udc82\udcac']
>  : roman8:['h\xc3\xa9\xe2\x82\xac']
> 
> --
> Ran 10 tests in 2.595s
> 
> FAILED (failures=1)
> test test_utf8_mode failed
> 1 test failed again:
> test_utf8_mode
> 
> == Tests result: FAILURE then FAILURE ==
> 
> 1 test failed:
> test_utf8_mode
> 
> 1 re-run test:
> test_utf8_mode
> 
> Total duration: 7 sec 265 ms
> Tests result: FAILURE then FAILURE
> Makefile:1066: recipe for target 'test' failed
> gmake: *** [test] Error 2
> 

I tried to understand the issue, but my Python knowledge is too low, especially 
I do not understand by a byte array "arg = 'h\xe9\u20ac'.encode('utf-8')" is 
passed as one arg to the forked process.

I highly assume that this is related to the non-standard, default character 
encoding on HP-UX: https://en.wikipedia.org/wiki/HP_Roman#HP_Roman-8 (roman8).

A stupid 8 bit encoding. The very same snippet on FreeBSD says:
> $ LC_ALL=C python3.6 test_utf8.py
> US-ASCII:[]

Willing to test and modify if someone tells what to do.

--
components: Library (Lib), Tests
messages: 323516
nosy: michael-o
priority: normal
severity: normal
status: open
title: test_utf8_mode.test_cmd_line() fails on HP-UX due to false assumptions
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue34393] json.dumps - allow compression

2018-08-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

There are too many types of compression for this to be built-in to json. 
There's zlib, gzip, bzip, zip, and no doubt dozens of others. How would we 
chose one, or several? Which to leave out? How to pass in the many parameters 
to all of these compression algorithms?

As rushter points out, if your current compression library only compresses a 
file on disk, you should switch to a streaming compressor, like 
zlib.compressobj or gzip.GzipFile.

If Google Storage won't let you pass a streaming compressor as a parameter, 
then that should be a feature request to Google. I suspect you can actually 
pass a streaming compressor to it, but I have't investigated their API.

In any event, compression does not belong in the json library.

--
nosy: +eric.smith
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2018-08-14 Thread Christian Heimes


Christian Heimes  added the comment:

These Python versions no longer receive security updates. Please update.

--

___
Python tracker 

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



[issue34401] [solution] Make test_gdb work on HP-UX

2018-08-14 Thread Michael Osipov


Change by Michael Osipov <1983-01...@gmx.net>:


--
title: Make test_gdb work on HP-UX -> [solution] Make test_gdb work on HP-UX

___
Python tracker 

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



[issue34402] [SOLUTION] strftime fails on HP-UX

2018-08-14 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

The worst thing about wcsftime(3) is that it silently fails by not writing to 
output buffer. timemodule.c allocates more and more memory and then gives up.

--

___
Python tracker 

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



[issue34402] [SOLUTION] strftime fails on HP-UX

2018-08-14 Thread Michael Osipov


New submission from Michael Osipov <1983-01...@gmx.net>:

strftime() fails on HP-UX. It is mapped to wcsftime(3). It has a quirk on HP-UX 
that is does not conform to POSIX. To enable POSIX compat one has to do 
(excerpt from manpage):
> APPLICATION USAGE
>   The "Unix Standards Only" prototype of wcsftime() is available to
>   applications if they are:
>a. c99 conformant.
> 
>b. Compiled with -D_XOPEN_SOURCE macro with a value >=500.
> 
>c. Compiled with -D_POSIX_C_SOURCE macro with a value >= 200112.
> 
>   Also the application must be compiled with the environment variable
>   UNIX_STD set to the value 98 or above and exported.

b and c are satasfied according to config.log. Let's get to a). The manpage of 
aCC says:
>  EXTERNAL INFLUENCES
> Environment Variables
>   [...]
>   UNIX95 or UNIX_STD specify the XPG4 behavior for c89(1) and c99(1).
>   -D_XOPEN_UNIX is also set.  UNIX_STD must be set to 1995, 1998 or
>   2003.  Both these variables cause an appropriate object file to be
>   linked into executables in order to customize libc to match ISO/IEC
>   9899:1990/Amendment 1:1995 (1995) and the C++ and C99 Standards for
>   the various wide char (1998) or other C99 libc functions (2003).
>   NOTE: 2003 is only available on HP-UX 11.31.

So one must at least do "export UNIX_STD=1998".

I am quite certain that other parts of Python are affected too.

The safest bet would be actually to test wcsftime at configure time wether the 
output is fine and have this env var set in the Makefile, unfortunately, this 
will only work for GNU make. Alternatively, a warning at the very end of the 
configure run has to be printed to export this env var.

If done, test_strftime and test_teststrptime will pass flawlessly.

--
components: Library (Lib)
messages: 323512
nosy: michael-o
priority: normal
severity: normal
status: open
title: [SOLUTION] strftime fails on HP-UX
type: crash
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



[issue15258] argparse documentation: Improve optparse section regarding allow_interspersed_args

2018-08-14 Thread Berker Peksag


Berker Peksag  added the comment:

ArgumentParser.parse_intermixed_arg() has been added in 
https://github.com/python/cpython/commit/0f6b9d230674da784ca79a0cf1a03d2af5a8b6a8
 (Issue 14191) and the "Upgrading optparse code" section now has the following 
item:

* Replace optparse.OptionParser.disable_interspersed_args()
  by using ArgumentParser.parse_intermixed_args() instead of
  ArgumentParser.parse_args().

Closing this as 'outdated'.

--
nosy: +berker.peksag
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2018-08-14 Thread Anuj


Anuj  added the comment:

Do we have patch for 3.1 version, or 3.2 patch will be also OK?

--
nosy: +Anuj

___
Python tracker 

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



[issue34387] Deletion of attributes in dataclass is buggy

2018-08-14 Thread Eric V. Smith


Eric V. Smith  added the comment:

I assume this is the behavior you're seeing:

>>> @dataclass
... class C:
...   i: int = 0
...
>>> c = C(10)
>>> c
C(i=10)
>>> del c.i
>>> c
C(i=0)
>>> del c.i
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: i
>>>

If so, that's the expected behavior. You're deleting an instance attribute, so 
that the class attribute with the same name is seen.

This also happens without dataclasses:

>>> class C:
...   i = 0
...   def __init__(self, i):
... self.i = i
...
>>> c = C(10)
>>> c.i
10
>>> del c.i
>>> c.i
0
>>> del c.i
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: i
>>>

If you're seeing something different, please re-open this issue.

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

___
Python tracker 

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



[issue34401] Make test_gdb work on HP-UX

2018-08-14 Thread Michael Osipov


Change by Michael Osipov <1983-01...@gmx.net>:


--
type:  -> crash

___
Python tracker 

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



[issue34401] Make test_gdb work on HP-UX

2018-08-14 Thread Michael Osipov


New submission from Michael Osipov <1983-01...@gmx.net>:

Regex in test_gdb.py needs to be changed and test can continue, though will be 
skipped due to old version.

--
components: Tests
files: test_gdb.patch
keywords: patch
messages: 323508
nosy: michael-o
priority: normal
severity: normal
status: open
title: Make test_gdb work on HP-UX
versions: Python 3.7
Added file: https://bugs.python.org/file47749/test_gdb.patch

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8240

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 88bfd0bce05043f658e50addd21366f317995e35 by Christian Heimes in 
branch 'master':
bpo-34399: 2048 bits RSA keys and DH params (#8762)
https://github.com/python/cpython/commit/88bfd0bce05043f658e50addd21366f317995e35


--

___
Python tracker 

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



[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-14 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

> Could you elaborate a bit more on how/where the leak happens?

It happens when PyMem_Resize() fails. It was used like this:

Py_UCS4 *field = self->field;
self->field = PyMem_Resize(field, Py_UCS4, self->field_size);

The last statement changes both self->field and field (macro magic!), so in the 
case PyMem_Resize() fails, previously allocated memory can't be freed.

--

___
Python tracker 

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



Re: Pylint false positives

2018-08-14 Thread Frank Millman
"Thomas Jollans"  wrote in message 
news:53faf0ef-4054-53fa-6179-a862495ea...@tjol.eu...


On 2018-08-14 09:38, Frank Millman wrote:
> Hi all
>
> Pylint is flagging a lot of lines as errors that I would consider to be
> acceptable.
>
> I have an abstract class ClassA with a number of concrete sub-classes.
> ClassA has a method which invokes 'self.method_b()' which is defined
> separately on each sub-class. Pylint complains that "Instance of
> 'ClassA' has no  'method_b' member".
>
> First question - as a matter of style, is Pylint correct? If so, I could
> define 'method_b' in ClassA and raise NotImplementedError. Is this
> considered more pythonic? The downside is that I have quite a few of
> them, so it would add some clutter.

I wouldn't say it's unpythonic per se, but if your ClassA is logically
an abstract base class that requires certain methods to be implemented
in subclasses, then it's probably clearer to use Python's abc [1]
facilities, and declare your abstract methods as actual abstractmethods.


[1]: https://docs.python.org/3/library/abc.html



Thanks for the pointer - I will look into that alternative.

[...]



You *can* raise NotImplementedError in your abstractmethods, but I don't
think it's really necessary. You need a statement in the method body of
course, but since you're going to put a docstring there anyway (right?),
that's already taken care of.



At first I thought that it would be necessary, but then I saw in the docs 
that an ABC class "cannot be instantiated unless all of its abstract methods 
and properties are overridden", so there is no danger of forgetting to add 
it to the subclass.


Frank


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


[issue34400] Undefined behavior in Parser/parsetok.c

2018-08-14 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue34400] Undefined behavior in Parser/parsetok.c

2018-08-14 Thread Zackery Spytz


New submission from Zackery Spytz :

In parsetok(), null pointers are used in pointer arithmetic.

--
components: Interpreter Core
messages: 323505
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: Undefined behavior in Parser/parsetok.c
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Pylint false positives

2018-08-14 Thread Thomas Jollans
On 2018-08-14 09:38, Frank Millman wrote:
> Hi all
> 
> Pylint is flagging a lot of lines as errors that I would consider to be
> acceptable.
> 
> I have an abstract class ClassA with a number of concrete sub-classes.
> ClassA has a method which invokes 'self.method_b()' which is defined
> separately on each sub-class. Pylint complains that "Instance of
> 'ClassA' has no  'method_b' member".
> 
> First question - as a matter of style, is Pylint correct? If so, I could
> define 'method_b' in ClassA and raise NotImplementedError. Is this
> considered more pythonic? The downside is that I have quite a few of
> them, so it would add some clutter.

I wouldn't say it's unpythonic per se, but if your ClassA is logically
an abstract base class that requires certain methods to be implemented
in subclasses, then it's probably clearer to use Python's abc [1]
facilities, and declare your abstract methods as actual abstractmethods.

[1]: https://docs.python.org/3/library/abc.html

i.e.

from abc import ABC, abstractmethod
class ClassA(ABC):
def do_stuff(self):
return self.method_b(42)**3

@abstractmethod
def method_b(self, answer):
"""
This is a great place to put a docstring
"""

You *can* raise NotImplementedError in your abstractmethods, but I don't
think it's really necessary. You need a statement in the method body of
course, but since you're going to put a docstring there anyway (right?),
that's already taken care of.

-- Thomas


> Second question - if my present code is not unpythonic, is there an easy
> way to suppress the error messages, without disabling 'no-member'
> altogether?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pylint false positives

2018-08-14 Thread Frank Millman
"D'Arcy Cain"  wrote in message 
news:865ed61a-cf1d-959f-f77e-dc586fe6e...@vybenetworks.com...


On 2018-08-14 03:38 AM, Frank Millman wrote:
> Hi all
>
> Pylint is flagging a lot of lines as errors that I would consider to be
> acceptable.
>
> I have an abstract class ClassA with a number of concrete sub-classes.
> ClassA has a method which invokes 'self.method_b()' which is defined
> separately on each sub-class. Pylint complains that "Instance of
> 'ClassA' has no  'method_b' member".
>
> First question - as a matter of style, is Pylint correct? If so, I could
> define 'method_b' in ClassA and raise NotImplementedError. Is this
> considered more pythonic? The downside is that I have quite a few of
> them, so it would add some clutter.

I would add the method.  It's one line:

  def method_b(self): raise NotImplementedError

When you say that you have quite a lot of them, what is "them"?  Many
master classes or many methods in the class?  If the latter, one line
each isn't so bad.  If the former I wonder if a master, master class is
called for.



I do mean a lot of methods, not classes. I don't have any problem adding the 
lines. It is just that, before I starting using pylint, it had not occurred 
to me that there was any problem with my approach. If an experienced python 
programmer was reviewing my code, would they flag it as 'bad style'?



I am also getting a funny smell from your description.  Are you sure
that you need to redefine the methods?  Perhaps you just need to define
some class variables and use one method.  You can also define your own
method and call the classA method inside it for common functionality.



As an example, I have a master class defining a unit of data (i.e. the value 
of a column) retrieved from a database. I have separate sub-classes for each 
data type - text, integer, date, etc. To ensure that a value is valid before 
storing it as an instance attribute, I call a method called 'check_value'. 
The details of check_value vary according to the data type, but that is 
transparent to the piece of code that calls check_value().


Frank


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


[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue34399] [TLS] Update test keys to >= 2048bit

2018-08-14 Thread Christian Heimes


New submission from Christian Heimes :

Downstream vendors have started to tighten security. 1024 bits RSA and DH 
params are no longer considered as secure. Python 3.7 and master already use 
2048 bits RSA keys for some tests (bpo-32602). 3.6 and 2.7 don't have 1024bit 
keys. DH params and some other certs are still 1024 bits.

I'm going to update all keys and parameters to 2048.

--
assignee: christian.heimes
components: SSL, Tests
messages: 323504
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: [TLS] Update test keys to >= 2048bit
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Pylint false positives

2018-08-14 Thread D'Arcy Cain
On 2018-08-14 03:38 AM, Frank Millman wrote:
> Hi all
> 
> Pylint is flagging a lot of lines as errors that I would consider to be
> acceptable.
> 
> I have an abstract class ClassA with a number of concrete sub-classes.
> ClassA has a method which invokes 'self.method_b()' which is defined
> separately on each sub-class. Pylint complains that "Instance of
> 'ClassA' has no  'method_b' member".
> 
> First question - as a matter of style, is Pylint correct? If so, I could
> define 'method_b' in ClassA and raise NotImplementedError. Is this
> considered more pythonic? The downside is that I have quite a few of
> them, so it would add some clutter.

I would add the method.  It's one line:

  def method_b(self): raise NotImplementedError

When you say that you have quite a lot of them, what is "them"?  Many
master classes or many methods in the class?  If the latter, one line
each isn't so bad.  If the former I wonder if a master, master class is
called for.

I am also getting a funny smell from your description.  Are you sure
that you need to redefine the methods?  Perhaps you just need to define
some class variables and use one method.  You can also define your own
method and call the classA method inside it for common functionality.

Just my 2¢ based on no information about your actual application.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34398] Docs search does not index glossary

2018-08-14 Thread Jonathan Fine


New submission from Jonathan Fine :

The docs contain a very useful page https://docs.python.org/3.5/glossary.html. 
However, the search feature does not index the glossary.

Thus, the search https://docs.python.org/3.5/search.html?q=iterable does not 
produce the helpful glossary entry
===
iterable
An object capable of returning its members one at a time. Examples of iterables 
include all sequence types (such as list, str, and tuple) and some non-sequence 
types like dict, file objects, and objects of any  [...]
===

#788509 is the only docs issue I could find, whose title contains glossary. It 
gives insight into the thoughts then about the tutorial. In msg44460 Skip 
Montaro says (1) that the glossary is "for the tutorial", and (2) he'd like to 
improve links into the tutorial. 

I suggest that part of the fix for this issue is on the home page page Glossary 
in the first grouping "Parts of the documentation."

--
assignee: docs@python
components: Documentation
messages: 323503
nosy: docs@python, jfine2358
priority: normal
severity: normal
status: open
title: Docs search does not index glossary
type: behavior
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



[issue32947] Support OpenSSL 1.1.1

2018-08-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8237

___
Python tracker 

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



[issue32947] Support OpenSSL 1.1.1

2018-08-14 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8236

___
Python tracker 

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



Pylint false positives

2018-08-14 Thread Frank Millman

Hi all

Pylint is flagging a lot of lines as errors that I would consider to be 
acceptable.


I have an abstract class ClassA with a number of concrete sub-classes. 
ClassA has a method which invokes 'self.method_b()' which is defined 
separately on each sub-class. Pylint complains that "Instance of 'ClassA' 
has no  'method_b' member".


First question - as a matter of style, is Pylint correct? If so, I could 
define 'method_b' in ClassA and raise NotImplementedError. Is this 
considered more pythonic? The downside is that I have quite a few of them, 
so it would add some clutter.


Second question - if my present code is not unpythonic, is there an easy way 
to suppress the error messages, without disabling 'no-member' altogether?


Thanks

Frank Millman


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


Re: right way to use zipimport, zipimport.ZipImportError: not a Zip file

2018-08-14 Thread iMath
I think someone gives the true reason caused the exception here
https://stackoverflow.com/a/51821910/1485853

Thanks to his  explanation , I extracted the zip archive and then add the 
extracted to a zip archive using Bandizip, this time 
`zipimport.zipimporter(r'C:\Users\i\Downloads\you-get-0.4.1128.zip') ` doesn't 
give the exception , but still cannot import the module, even adding the  
`.zip`  file to  `sys.path`,

>>> import sys
>>> sys.path.insert(0, 
r'C:\Users\i\Downloads\you-get-0.4.1128.zip\you-get-0.4.1128\src')
>>> from you_get import common
Traceback (most recent call last):
  File "", line 1, in 
from you_get import common
ModuleNotFoundError: No module named 'you_get'
>>> 


>>> import zipimport
>>> 
z=zipimport.zipimporter(r'C:\Users\i\Downloads\you-get-0.4.1128.zip\you-get-0.4.1128\src')
>>> z

>>> z.load_module('you_get.common')
Traceback (most recent call last):
  File "", line 1, in 
z.load_module('you_get.common')
zipimport.ZipImportError: can't find module 'you_get.common'
>>> z.load_module('you_get')
Traceback (most recent call last):
  File "", line 1, in 
z.load_module('you_get')
zipimport.ZipImportError: can't find module 'you_get'


What I actually want to do is to use the module in  a pyinstaller frozen 
application  , I also need to upgrade  the module  to latest version whenever 
needed , I cannot find a solution yet.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: right way to use zipimport, zipimport.ZipImportError: not a Zip file

2018-08-14 Thread iMath
I think someone gives the true reason caused the exception here
https://stackoverflow.com/a/51821910/1485853

Thanks to his  explanation , I extracted the zip archive and then add the 
extracted to a zip archive using Bandizip, this time 
`zipimport.zipimporter(r'C:\Users\i\Downloads\you-get-0.4.1128.zip') ` doesn't 
give the exception , but still cannot import the module, even adding the  
`.zip`  file to  `sys.path`,

>>> import sys
>>> sys.path.insert(0, 
r'C:\Users\i\Downloads\you-get-0.4.1128.zip\you-get-0.4.1128\src')
>>> from you_get import common
Traceback (most recent call last):
  File "", line 1, in 
from you_get import common
ModuleNotFoundError: No module named 'you_get'
>>> 


>>> import zipimport
>>> 
z=zipimport.zipimporter(r'C:\Users\i\Downloads\you-get-0.4.1128.zip\you-get-0.4.1128\src')
>>> z

>>> z.load_module('you_get.common')
Traceback (most recent call last):
  File "", line 1, in 
z.load_module('you_get.common')
zipimport.ZipImportError: can't find module 'you_get.common'
>>> z.load_module('you_get')
Traceback (most recent call last):
  File "", line 1, in 
z.load_module('you_get')
zipimport.ZipImportError: can't find module 'you_get'


What I actually want to do is to use the module in  a pyinstaller frozen 
application  , I also need to upgrade  the module  to latest version whenever 
needed , I cannot find a solution yet.
-- 
https://mail.python.org/mailman/listinfo/python-list