[issue13829] exception error in _scproxy.so when called after fork

2018-03-27 Thread triccare triccare

triccare triccare <tricc...@gmail.com> added the comment:

I have run into this bug which can be reliably reproduced by importing tkinter.

However, I have found another workaround if one does not want to deal with the 
environmental variable and may point to a possible bug fix. Before forking, any 
use of `urlopen` alleviates the bug. This is demonstrated in the attached 
example.

Example works under Python 3.6.4 and Mac OS 10.12.6

--
nosy: +triccare triccare
Added file: https://bugs.python.org/file47503/debug_urlopen.py

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue13829>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why keys method does not work with MutableMapping?

2016-11-12 Thread triccare triccare
Ahhh, and what is being shown is simply the __repr__. Gotcha. Thanks!

On Fri, Nov 11, 2016 at 1:03 PM, Rob Gaddi <
rgaddi@highlandtechnology.invalid> wrote:

> triccare triccare wrote:
>
> > Greetings,
> >
> > Apologies if this has shown up twice; I jumped the gun sending before
> > confirming registration.
> >
> > I have a class that completely implements MutableMapping, meaning that
> all
> > the abstract methods are implemented. However, the keys method no longer
> > returns the keys, but simply a repr of the instance.  Example is below.
> > Same is true for the items method.
> >
> > It would seem that, if all the abstract methods have been implemented,
> the
> > keys and items methods should be able to perform exactly like the native
> > dict versions. There does not seem to be a need to override these
> methods.
> >
> > Thank you for your time.
> > triccare
> >
> > Code:
> >
> > from collections import MutableMapping
> >
> > class MyDict(MutableMapping):
> >
> > def __init__(self, *args, **kwargs):
> > self.data = dict(*args, **kwargs)
> >
> > def __getitem__(self, key):
> > return self.data[self.__keytransform__(key)]
> >
> > def __setitem__(self, key, value):
> > self.data[self.__keytransform__(key)] = value
> >
> > def __delitem__(self, key):
> > del self.data[self.__keytransform__(key)]
> >
> > def __iter__(self):
> > return iter(self.data)
> >
> > def __len__(self):
> > return len(self.data)
> >
> > def __keytransform__(self, key):
> > return key
> >
> > md = MyDict({'a': 1, 'b':2})
> > md.keys()
> > ==> KeysView()
>
> Nope, that's exactly right.  That's the python3 behavior.
>
> >>> d = {'a': 1, 'b':2}
> >>> d.keys()
> dict_keys(['b', 'a'])
>
> Keys returns a dedicated keys object now, not just a list.  That thing
> you got back isn't a repr string; it's the actual object.  If it were a
> string it'd be quoted.
>
> Try list(md.keys()).
>
>
> --
> 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
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Why keys method does not work with MutableMapping?

2016-11-11 Thread triccare triccare
Greetings,

Apologies if this has shown up twice; I jumped the gun sending before
confirming registration.

I have a class that completely implements MutableMapping, meaning that all
the abstract methods are implemented. However, the keys method no longer
returns the keys, but simply a repr of the instance.  Example is below.
Same is true for the items method.

It would seem that, if all the abstract methods have been implemented, the
keys and items methods should be able to perform exactly like the native
dict versions. There does not seem to be a need to override these methods.

Thank you for your time.
triccare

Code:

from collections import MutableMapping

class MyDict(MutableMapping):

def __init__(self, *args, **kwargs):
self.data = dict(*args, **kwargs)

def __getitem__(self, key):
return self.data[self.__keytransform__(key)]

def __setitem__(self, key, value):
self.data[self.__keytransform__(key)] = value

def __delitem__(self, key):
del self.data[self.__keytransform__(key)]

def __iter__(self):
return iter(self.data)

def __len__(self):
return len(self.data)

def __keytransform__(self, key):
return key

md = MyDict({'a': 1, 'b':2})
md.keys()
==> KeysView()
-- 
https://mail.python.org/mailman/listinfo/python-list


Why keys method does not work with MutableMapping?

2016-11-11 Thread triccare triccare
I have a class that completely implements MutableMapping, meaning that all
the abstract methods are implemented. However, the keys method no longer
returns the keys, but simply a repr of the instance.  Example is below.
Same is true for the items method.

It would seem that, if all the abstract methods have been implemented, the
keys and items methods should be able to perform exactly like the native
dict versions. There does not seem to be a need to override these methods.

Thank you for your time.
triccare

Code:

from collections import MutableMapping

class MyDict(MutableMapping):

def __init__(self, *args, **kwargs):
self.data = dict(*args, **kwargs)

def __getitem__(self, key):
return self.data[self.__keytransform__(key)]

def __setitem__(self, key, value):
self.data[self.__keytransform__(key)] = value

def __delitem__(self, key):
del self.data[self.__keytransform__(key)]

def __iter__(self):
return iter(self.data)

def __len__(self):
return len(self.data)

def __keytransform__(self, key):
return key

md = MyDict({'a': 1, 'b':2})
md.keys()
==> KeysView()
-- 
https://mail.python.org/mailman/listinfo/python-list