[Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Serhiy Storchaka
PyObject_IsInstance is not safe when used to check if the object is an instance of specified builtin type. Typical code: rc = PyObject_IsInstance(obj, &Someting_Type); if (rc < 0) return NULL; if (rc) { SometingObject *something = (SometingObject *)obj; something->som

Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Greg Ewing
Serhiy Storchaka wrote: PyObject_IsInstance is not safe when used to check if the object is an instance of specified builtin type. The __class__ attribute can be modified and PyObject_IsInstance() can return true if the object has not layout compatible with specified structure. Code that re

Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Serhiy Storchaka
On 18.05.15 15:14, Greg Ewing wrote: Serhiy Storchaka wrote: PyObject_IsInstance is not safe when used to check if the object is an instance of specified builtin type. The __class__ attribute can be modified and PyObject_IsInstance() can return true if the object has not layout compatible with

Re: [Python-Dev] PyObject_IsInstance is dangerous

2015-05-18 Thread Greg Ewing
Serhiy Storchaka wrote: May be modify PyObject_IsInstance so that it will never return true if layouts are not compatible? That wouldn't be a good idea, since PyObject_IsInstance is meant to reflect the behaviour of python's isinstance() function, which doesn't care about C layouts. -- Greg __

Re: [Python-Dev] PEP 484 wishes

2015-05-18 Thread Alex Grönholm
18.05.2015, 02:50, Guido van Rossum kirjoitti: On Sun, May 17, 2015 at 3:07 PM, Alex Grönholm mailto:alex.gronh...@nextday.fi>> wrote: Looking at PEP 484, I came up with two use cases that I felt were not catered for: 1. Specifying that a parameter should be a subclass of anothe

[Python-Dev] PEP 484 wishes

2015-05-18 Thread Ivan Levkivskyi
> > Looking at PEP 484, I came up with two use cases that I felt were not > > catered for: > > > >1. Specifying that a parameter should be a subclass of another > >(example: Type[dict] would match dict or OrderedDict; plain "Type" would > >equal "type" from builtins) > > > > > I don't

Re: [Python-Dev] PEP 484 wishes

2015-05-18 Thread Guido van Rossum
On Mon, May 18, 2015 at 12:14 AM, Alex Grönholm wrote: > > > 18.05.2015, 02:50, Guido van Rossum kirjoitti: > > On Sun, May 17, 2015 at 3:07 PM, Alex Grönholm > wrote: > >> Looking at PEP 484, I came up with two use cases that I felt were not >> catered for: >> >>1. Specifying that a param

Re: [Python-Dev] PEP 485 isclose() implementation review requested

2015-05-18 Thread Chris Barker
Thanks Cristian, that clears up a couple things -- got it compiling without warning. But I also discovered that I must have not pushed the latest copy yesterday. It's on a machine at home -- I'll push it tonight. But the copy on gitHub now is mostly good -- I think the only changes are handling t

Re: [Python-Dev] PEP 485 isclose() implementation review requested

2015-05-18 Thread Christian Heimes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On 2015-05-18 17:49, Chris Barker wrote: > Thanks Cristian, that clears up a couple things -- got it > compiling without warning. > > But I also discovered that I must have not pushed the latest copy > yesterday. > > It's on a machine at home -- I'

Re: [Python-Dev] PEP 484 wishes

2015-05-18 Thread Alex Grönholm
18.05.2015, 18:05, Guido van Rossum kirjoitti: On Mon, May 18, 2015 at 12:14 AM, Alex Grönholm mailto:alex.gronh...@nextday.fi>> wrote: 18.05.2015, 02:50, Guido van Rossum kirjoitti: On Sun, May 17, 2015 at 3:07 PM, Alex Grönholm mailto:alex.gronh...@nextday.fi>> wrote:

Re: [Python-Dev] PEP 484 wishes

2015-05-18 Thread Guido van Rossum
Can you add your example to the issue? https://github.com/ambv/typehinting/issues/107 We're trying to finish up PEP 484 in the next few days (wait for an announcement :-) and we just don't have time for every use case; but over the course of 3.5 we will be adding features that are considered usefu

[Python-Dev] Gcode path

2015-05-18 Thread Lisa Colvard
I am trying to get Replicatorg to use python to gcode but it keeps giving the error "generate Gcode requires that a Python interpreter be installed. Would you like to visit the Python download page now? I tell it no because I have it installed. I have even gone in and selected the path for t

Re: [Python-Dev] Gcode path

2015-05-18 Thread Guido van Rossum
Hi Lisa, It's unlikely that anyone on this list can help you with this. It's a question you should ask of the ReplicatorG people, not the Python people... --Guido On Mon, May 18, 2015 at 12:02 PM, Lisa Colvard < lcolv...@horrycountyschools.net> wrote: > I am trying to get Replicatorg to use py

Re: [Python-Dev] Gcode path

2015-05-18 Thread Terry Reedy
On 5/18/2015 4:18 PM, Guido van Rossum wrote: It's unlikely that anyone on this list can help you with this. It's a question you should ask of the ReplicatorG people, not the Python people... If that does not work, try stackoverflow, or possibly even python-list. This list is focused only on

Re: [Python-Dev] Gcode path

2015-05-18 Thread Chris Barker
Lisa, As noted, not the right list. But seeing this kind of stuff done in High Schools is GREAT! So one suggestion: If this is Windows, there are two versions of python for Windows: 32bit and 64bit -- if an installer for a third-party package is looking for one of those, and the other is instal