TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ALL
from: R.WIESER
date: 2019-12-04 10:14:00
subject: Re: RPi.GPIO-0.7.0 - a fe

Richard,

> It certainly isn't going to cause the function to be called
> different numbers of times at some point in the future;

Are you sure ?

1) The "PWMType.tp_new = PyType_GenericNew;" inside the "PWM_init_PWMType"
function is called exactly /once/ when the GPIO module is loaded..

2)AFAIK the "tp_new" function is called /every time/ you instanciate the PWM
class on a selected pin.

So yes, AFAIKS there are different call numbers.

That means that in the origional code I see a single PyType_GenericNew
instance being created before any PWM class instanciation is done and (thus)
shared between all PWM class instanciations. (with the "tp_new" call just
incrementing the reference count)

Moving the "PyType_GenericNew" into the table means that every time a PWM
class is instanciated (and its "tp_new" member is called) a new
PyType_GenericNew is instanciated too.

> if you think that it is then you need to revisit your mental
> model of what is going on here.

I did.   And the above is, after careful consideration, what I now have.

If you know where my above "mental model" goes wrong than please do tell, as
I'm now in a state of confusion: my assumption/knowledge of what is going on
there does not stroke with your assurance that that is not what happens -
and I have no idea why.

Regards,
Rudy Wieser

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.