Re: A Single Instance of an Object?

2024-03-11 Thread Peter J. Holzer via Python-list
self.cache[key] = value > return value > > Now it is easier to unit test, and the cache is not global. However, I > cannot instantiate Lookup inside the while- or for- loops in main(), > because the cache should be only one. I need to ensure there is only > one instance of

Re: A Single Instance of an Object?

2024-03-11 Thread Chris Angelico via Python-list
On Tue, 12 Mar 2024 at 08:04, Ivan "Rambius" Ivanov wrote: > > A Singleton is just a global variable. Why do this? Did someone tell > > you "global variables are bad, don't use them"? > > I have bad experience with global variables because it is hard to > track what and when modifies them. I

Re: A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
ookup(key) method > > clumsy, because I have to clean it after each unit test. I refactored > > it as: > > > > class Lookup: > > def __init__(self): > > self.cache = {} > > > > Change "cache" to be a class-attribute (it is currently

Re: A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
On Mon, Mar 11, 2024 at 5:01 PM Chris Angelico via Python-list wrote: > > On Tue, 12 Mar 2024 at 07:54, Ivan "Rambius" Ivanov via Python-list > wrote: > > I am refactoring some code and I would like to get rid of a global > > variable. Here is the outline: > > > > ... > > > > I have never done

Re: A Single Instance of an Object?

2024-03-11 Thread dn via Python-list
be a class-attribute (it is currently an instance. Then, code AFTER the definition of Lookup can refer to Lookup.cache, regardless of instantiation, and code within Lookup can refer to self.cache as-is... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A Single Instance of an Object?

2024-03-11 Thread Chris Angelico via Python-list
On Tue, 12 Mar 2024 at 07:54, Ivan "Rambius" Ivanov via Python-list wrote: > I am refactoring some code and I would like to get rid of a global > variable. Here is the outline: > > ... > > I have never done that in Python because I deliberately avoided such > complicated situations up to now. I

A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
gger.error("cmd returned error") self.cache[key] = value return value Now it is easier to unit test, and the cache is not global. However, I cannot instantiate Lookup inside the while- or for- loops in main(), because the cache should be only one. I need to ensure there i

how to connect linux aws ec2 instance to windows local machine at my home using paramiko

2023-11-27 Thread Kashish Naqvi via Python-list
I have a north viriginia ec2 linux instance and a windows machine at my home, how do I connec tthem? import paramiko import time def run_scripts(): # Set your local machine's SSH details local_machine_ip = ' ' username = 'justk' private_key_path = 'C:/Users/justk/.ssh/kashish

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
Thank you. > On 16 Nov 2023, at 21:30, Dieter Maurer wrote: > > Dom Grigonis wrote at 2023-11-16 21:11 +0200: >> ... >>> On 16 Nov 2023, at 21:00, Dieter Maurer wrote: >>> ... >>> Methods are not bound during instance creation, they are bound du

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
Dom Grigonis wrote at 2023-11-16 21:11 +0200: > ... >> On 16 Nov 2023, at 21:00, Dieter Maurer wrote: >> ... >> Methods are not bound during instance creation, they are bound during >> access. > >Good to know. What is the criteria for binding then? Does i

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
eal as there would be too much >> overhead. >> >> I think what I am looking for is custom method binding. > > Methods are not bound during instance creation, they are bound during > access. Good to know. What is the criteria for binding then? Does it check if

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
r is custom method binding. Methods are not bound during instance creation, they are bound during access. You can use descriptors to implement "custom method binding". Descriptors are defined on the class (and do not behave as descriptors when defined on instances). Thus

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
class method. > >I was wandering if there is an equivalent functionality of attribute to >receive `instance` argument on instance creation. As PEP 487 describes, `__set_name__` essentially targets descriptors. It is there to inform a descriptor about the name it is used for in a

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
` argument. >> >> Thus, allowing simulation of bound class method. >> >> I was wandering if there is an equivalent functionality of attribute to >> receive `instance` argument on instance creation. > > As PEP 487 describes, `__set_name__` essentially targets descri

__set_name__ equivalent for instance

2023-11-15 Thread Dom Grigonis via Python-list
of attribute to receive `instance` argument on instance creation. Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

Re: How to replace an instance method?

2022-09-21 Thread Diego Souza
- Diego Souza Wespa Intelligent Systems Rio de Janeiro - Brasil On Mon, Sep 19, 2022 at 1:00 PM wrote: > > > From: "Weatherby,Gerard" > Date: Mon, 19 Sep 2022 13:06:42 + > Subject: Re: How to replace an instance method? > Just subclass and override whatever method you

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/19/22, 2qdxy4rzwzuui...@potatochowder.com <2qdxy4rzwzuui...@potatochowder.com> wrote: > On 2022-09-18 at 09:11:28 +, > Stefan Ram wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >> >types.MethodType( function, instance ) >> &g

Re: How to replace an instance method?

2022-09-19 Thread 2QdxY4RzWzUUiLuE
On 2022-09-18 at 09:11:28 +, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): > >types.MethodType( function, instance ) > >functools.partial( function, instance ) > >new_method.__get__( instance ) > > I wonder which of these th

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/18/22, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >>types.MethodType( function, instance ) >>functools.partial( function, instance ) >>new_method.__get__( instance ) > > I wonder which of these three possibilities expresses >

Re: How to replace an instance method?

2022-09-19 Thread Weatherby,Gerard
22 um 00:35 schrieb Dan Stromberg: On Fri, Sep 16, 2022 at 2:06 PM Ralf M. mailto:ral...@t-online.de>> wrote: I would like to replace a method of an instance, but don't know how to do it properly. You appear to have a good answer, but... are you sure this is a good idea? It's definitely a d

Re: How to replace an instance method?

2022-09-18 Thread Lars Liedtke
ivacy policy https://www.solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php Am 16.09.22 um 22:55 schrieb Ralf M.: I would like to replace a method of an instance, but don't know how to do it properly. My first naive idea was inst = SomeClass() def new_method(self, param): #

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
accessed as a method of an instance of the class. In the class, that's just a function object; it's exactly a function, not merely fundamentally the same thing as one. It's only when accessed as an attribute of an instance of the type that the function's descriptor __get__() method is calle

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
On Sun, 18 Sept 2022 at 10:29, wrote: > > > From your description, Chris, it sounds like the functional programming > technique often called currying. A factory function is created where one (or > more) parameters are sort of frozen in so the user never sees or cares about > them, and a modified

RE: How to replace an instance method?

2022-09-17 Thread avi.e.gross
ase, the function now knows what object it is attached to as this. -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Saturday, September 17, 2022 8:21 PM To: python-list@python.org Subject: Re: How to replace an instance method? On Sun, 18 Sept 2022 at 09:37, Eryk

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
ject is set > as an attribute of a type, the method does not rebind as a new method > when accessed as an attribute of an instance of the type. An unbound method in Python 2 was distinctly different from a function, but in Python 3, they really truly are the same thing. A bound method object is

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
g function (i.e. the method's __func__), such as inspecting the __name__ and __code__. A fundamental difference is that, unlike a function, a method is not a descriptor. Thus if a method object is set as an attribute of a type, the method does not rebind as a new method when accessed as an attribute

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
On Sun, 18 Sept 2022 at 07:20, Ralf M. wrote: > > Am 16.09.2022 um 23:34 schrieb Eryk Sun: > > On 9/16/22, Ralf M. wrote: > >> I would like to replace a method of an instance, but don't know how to > >> do it properly. > > > > A function is a descr

Re: How to replace an instance method?

2022-09-17 Thread Ralf M.
Am 17.09.2022 um 00:35 schrieb Dan Stromberg: On Fri, Sep 16, 2022 at 2:06 PM Ralf M. <mailto:ral...@t-online.de>> wrote: I would like to replace a method of an instance, but don't know how to do it properly. You appear to have a good answer, but...  are you sure this

Re: How to replace an instance method?

2022-09-17 Thread Ralf M.
Am 16.09.2022 um 23:34 schrieb Eryk Sun: On 9/16/22, Ralf M. wrote: I would like to replace a method of an instance, but don't know how to do it properly. A function is a descriptor that binds to any object as a method. For example: >>> f = lambda self, x: self + x &

Re: How to replace an instance method?

2022-09-16 Thread Thomas Passin
Here is an example of probably the easiest way to add an instance method: class Demo: def sqr(self, x): return x*x # Function to turn into a instance method def cube(self, x): return x*x*x d = Demo() print(d.sqr(2)) d.cube = cube.__get__(d) print(d.cube(3)) As for when

Re: How to replace an instance method?

2022-09-16 Thread Dan Stromberg
On Fri, Sep 16, 2022 at 2:06 PM Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. > You appear to have a good answer, but... are you sure this is a good idea? It'll probably be confusing to future maintainers of this code, an

Re: How to replace an instance method?

2022-09-16 Thread Eryk Sun
On 9/16/22, Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. A function is a descriptor that binds to any object as a method. For example: >>> f = lambda self, x: self + x >>> o = 42 >>>

Re: How to replace an instance method?

2022-09-16 Thread Chris Angelico
On Sat, 17 Sept 2022 at 07:07, Ralf M. wrote: > > I would like to replace a method of an instance, but don't know how to > do it properly. > > My first naive idea was > > inst = SomeClass() > def new_method(self, param): > # do something > return whate

How to replace an instance method?

2022-09-16 Thread Ralf M.
I would like to replace a method of an instance, but don't know how to do it properly. My first naive idea was inst = SomeClass() def new_method(self, param): # do something return whatever inst.method = new_method however that doesn't work: self isn't passed as first parameter

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-28 Thread Barry
> On 27 May 2022, at 21:17, Larry Martell wrote: > > I have a script that has literally been running for 10 years. > Suddenly, for some runs it crashes with the error: > > terminate called after throwing an instance of > 'boost::python::error_already_set This

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread dn
; Suddenly, for some runs it crashes with the error: > > > > terminate called after throwing an instance of > 'boost::python::error_already_set > > > > No stack trace. Anyone have any thoughts on what could cause this > > and/or how I ca

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread Larry Martell
On Fri, May 27, 2022 at 5:51 PM dn wrote: > On 28/05/2022 08.14, Larry Martell wrote: > > I have a script that has literally been running for 10 years. > > Suddenly, for some runs it crashes with the error: > > > > terminate called after throwing an i

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread dn
On 28/05/2022 08.14, Larry Martell wrote: > I have a script that has literally been running for 10 years. > Suddenly, for some runs it crashes with the error: > > terminate called after throwing an instance of > 'boost::python::error_already_set > > No stack trace. Any

terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-27 Thread Larry Martell
I have a script that has literally been running for 10 years. Suddenly, for some runs it crashes with the error: terminate called after throwing an instance of 'boost::python::error_already_set No stack trace. Anyone have any thoughts on what could cause this and/or how I can track it down

[issue532646] Recursive class instance "error"

2022-04-10 Thread admin
Change by admin : -- github: None -> 36294 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210653] Assigning function objects to instance variable causes memory leak (PR#346)

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue504943] call warnings.warn with Warning instance

2022-04-10 Thread admin
Change by admin : -- github: None -> 35936 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue469411] Better exception message: wrong instance

2022-04-10 Thread admin
Change by admin : -- github: None -> 35299 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue217241] class.method(*([self]+args)) gave me a 'unbound method must be called with class instance 1st argument" error message.

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue400730] UserList/UserString: Do creation of new instance in new func

2022-04-10 Thread admin
Change by admin : ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue217241] class.method(*([self]+args)) gave me a 'unbound method must be called with class instance 1st argument" error message.

2022-04-10 Thread admin
Change by admin : -- github: None -> 33366 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue210653] Assigning function objects to instance variable causes memory leak (PR#346)

2022-04-10 Thread admin
Change by admin : -- github: None -> 32724 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue400730] UserList/UserString: Do creation of new instance in new func

2022-04-10 Thread admin
Change by admin : -- github: None -> 32516 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40320] Add ability to specify instance of contextvars context to Task() & asyncio.create_task()

2022-03-23 Thread Andrew Svetlov
Andrew Svetlov added the comment: Duplicate of #46994 -- resolution: -> duplicate stage: patch review -> resolved status: open -> closed superseder: -> Accept explicit contextvars.Context in asyncio create_task() API ___ Python tracker

[issue35577] side_effect mocked method lose reference to instance

2022-03-19 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-03-11 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: This still behaves similarly after the bpo-46642 fix: >>> class V(TypeVar("T")): pass ... Traceback (most recent call last): File "", line 1, in File "/Users/jelle/py/cpython/Lib/typing.py", line 906, in __init__ self.__constraints__ =

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread SpaceOne
SpaceOne added the comment: @iritkatriel alright, I am sorry. I created another PR: https://github.com/python/cpython/pull/31823 -- ___ Python tracker ___

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread SpaceOne
Change by SpaceOne : -- pull_requests: +29920 pull_request: https://github.com/python/cpython/pull/31823 ___ Python tracker ___ ___

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread Irit Katriel
Irit Katriel added the comment: That happened because your PR was wrong - it contained many commits that touched many files, all of whose owners were modified. If you make the PR against the main branch, the diff will not have all those files a and they will not be notified. --

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread SpaceOne
SpaceOne added the comment: @iritkatriel they were automatically added by github via your `.github/CODEOWNERS` file with the `**/*imap* @python/email-team` match. And they all will also be informed by another pull request. --

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread Irit Katriel
Irit Katriel added the comment: The people subscribed to the closed pr will not receive an email about a new pr which is opened correctly. What makes you think they would? -- ___ Python tracker

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread SpaceOne
SpaceOne added the comment: @iritkatriel I added a unit test to the branch. I can't create a new PR without creating a new branch. But that doesn't make much sense from a technical point. It only increases the number of existing merge requests. Also all the people subscribed to the current

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-11 Thread Irit Katriel
Irit Katriel added the comment: @spaceone I'd suggest you create a new PR. Once many people are subscribed to a PR we don't like to reopen it and spam everyone. It would also be necessary to add a unit test. -- nosy: +iritkatriel ___ Python

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-09 Thread Irit Katriel
Change by Irit Katriel : -- versions: -Python 3.7, Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-07 Thread SpaceOne
New submission from SpaceOne : imaplib raises an Exception with a bytes instance once (in login()) - all other places str instances are raised. Adjust the behavior of login() similar to authenticate() where self.error is called with a str instance. Especially for Python3 with strict bytes

[issue46943] fix[imaplib]: call Exception with string instance

2022-03-07 Thread SpaceOne
Change by SpaceOne : -- keywords: +patch pull_requests: +29837 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31722 ___ Python tracker ___

[issue46934] A started multiprocessing.Process instance cannot be serialised

2022-03-05 Thread Géry
Change by Géry : -- keywords: +patch pull_requests: +29821 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31701 ___ Python tracker ___

[issue46934] A started multiprocessing.Process instance cannot be serialised

2022-03-05 Thread Géry
: [Errno 2] No such file or directory ``` In the function `Application.__init__`, each call `multiprocessing.Process(target=self._worker)` initializes a `multiprocessing.Process` instance with the instance method `self._worker` as its `target` argument. `self._worker` is bound to `self` which has th

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The test is good. If we accidentally make a TypeVar instance subclassable, it will catch such error. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Gregory Beauregard
Gregory Beauregard added the comment: The issue in real code I had in mind was internal to cpython: if we remove the callable() check from _type_check naively, this test starts to fail. Both of our proposed changes happen to not fail this check. Given your second example, would you prefer

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Note that instances of most other types are non-subclassable "by accident". >>> class A(42): pass ... Traceback (most recent call last): File "", line 1, in TypeError: int() takes at most 2 arguments (3 given) >>> class B: ... def __init__(self,

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-05 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-05 Thread Gregory Beauregard
Gregory Beauregard added the comment: Fixing this test unblocks bpo-46644 -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-05 Thread Gregory Beauregard
Change by Gregory Beauregard : -- keywords: +patch pull_requests: +29324 stage: -> patch review pull_request: https://github.com/python/cpython/pull/31148 ___ Python tracker

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-05 Thread Gregory Beauregard
Gregory Beauregard added the comment: The reason this test passed before is a bit confusing. Run the following code standalone to see where the type(TypeVar('T'))(name, bases, namespace) check is coming from. ``` class TypeVar: def __init__(self, name, *constraints): # in actual

[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

2022-02-04 Thread Gregory Beauregard
(Lib) messages: 412544 nosy: AlexWaygood, GBeauregard, Jelle Zijlstra, gvanrossum, kj, sobolevn priority: normal severity: normal status: open title: typing: tested TypeVar instance subclass TypeError is incidental type: enhancement ___ Python tracker <ht

[issue19073] Inability to specific __qualname__ as a property on a class instance.

2022-01-25 Thread Irit Katriel
Irit Katriel added the comment: See also Issue41294. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41294] Allow '__qualname__' to be an instance of 'DynamicClassAttribute'

2022-01-25 Thread Irit Katriel
Irit Katriel added the comment: I think this is a duplicate of Issue19073. -- nosy: +iritkatriel ___ Python tracker ___ ___

[issue34697] ctypes: Crash if manually-created CField instance is used

2022-01-23 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.10, Python 3.11, Python 3.9 -Python 2.7, Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___

[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2022-01-23 Thread Ethan Furman
Ethan Furman added the comment: New changeset 691506f4e9408a1205166f99640946ad7822e302 by Weipeng Hong in branch 'main': bpo-46103: Fix inspect.getmembers to only get __bases__ from class (GH-30147) https://github.com/python/cpython/commit/691506f4e9408a1205166f99640946ad7822e302

[issue24527] The MimeTypes class cannot ignore global files per instance

2022-01-20 Thread Irit Katriel
Change by Irit Katriel : -- type: behavior -> enhancement versions: +Python 3.11 ___ Python tracker ___ ___ Python-bugs-list

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-10 Thread Lars Liedtke
server {    listen [::]:80;    listen 80;    server_name api.familie-liedtke.net;    location / {    return 301 https://$host$request_uri;    }    include /usr/local/etc/nginx/include/letsencrypt.conf; } server {    listen 443 ssl http2;    listen [::]:443 ssl http2;    server_name

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-10 Thread Lars Liedtke
I think this is more a thing of apporach. Nginx is quite simple to install and a config doing nothing else than redirecting https to https and proxying requests to a service (whichever tat is, in your case gunicorn) can become a nobrainer. That is what it became for me. Additionally the config

RE: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-08 Thread Kirill Ratkin
req/res on Gunicorn instance) b) Scalability (proxy can spread traffic on several Gunicorn instances) c) Maintenance (you can gracefully shutdown/restart Gunicorn instances one by one) d) Security (For example SSL certificate is configured in proxy only. There are another useful features which

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-08 Thread Skip Montanaro
Thanks all. I was hoping to get away without something more sophisticated like NGINX. This is just a piddly little archive of an old mailing list running on a single-core Ubuntu VM somewhere on the East Coast. Speed is not a real requirement. Load balancing seemed like overkill to me. Still, I

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-08 Thread Albert-Jan Roskam
I always use NGINX for this. Run Flask/Gunicorn on localhost:5000 and have NGINX rewrite https requests to localhost requests. In nginx.conf I automatically redirect every http request to https. Static files are served by NGINX, not by Gunicorn, which is faster. NGINX also allows you

Re: Gunicorn - HTTP and HTTPS in the same instance?

2022-01-07 Thread Kushal Kumaran
On Fri, Jan 07 2022 at 12:51:48 PM, Skip Montanaro wrote: > Hopefully some Pythonistas are also Gunicornistas. I've had little success > finding help with a small dilemma in the docs or in other more specific > sources. > > I'm testing out a new, small website. It is just Gunicorn+Flask. I'd

Gunicorn - HTTP and HTTPS in the same instance?

2022-01-07 Thread Skip Montanaro
Hopefully some Pythonistas are also Gunicornistas. I've had little success finding help with a small dilemma in the docs or in other more specific sources. I'm testing out a new, small website. It is just Gunicorn+Flask. I'd like to both listen for HTTP and HTTPS connections. Accordingly, in my

[issue19073] Inability to specific __qualname__ as a property on a class instance.

2022-01-07 Thread Irit Katriel
Irit Katriel added the comment: This is the check that is preventing qualname being a property: https://github.com/python/cpython/blob/994f90c0772612780361e1dc5fa5223dce22f70a/Objects/typeobject.c#L2853 Note that it is not the same check used for assignment, which is here:

[issue37489] pickling instance which inherited from Exception with keyword only parameter

2022-01-06 Thread Irit Katriel
Irit Katriel added the comment: > I want to known [...] how to implement the logic in code 2 (passing keyword > only parameter to __new__/__init__ when pickling for class inherted from > Exception) This is currently a problem, see issue27015. -- resolution: -> duplicate stage:

[issue37489] pickling instance which inherited from Exception with keyword only parameter

2022-01-06 Thread Irit Katriel
Irit Katriel added the comment: > I want to known why it is It's because Exception implements __reduce__ and that takes precedence over __getnewargs_ex__. You can see that with this example: import pickle class MyException(): def __init__(self, desc, item):

[issue43639] Do not raise AttributeError on instance attribute update/deletion if data descriptor with missing __set__/__delete__ method found on its type

2021-12-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43639] Do not raise AttributeError on instance attribute update/deletion if data descriptor with missing __set__/__delete__ method found on its type

2021-12-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm going to decline this one. * It is arguable whether or not this behavior should have been designed in originally. However, changing it now is risky (as noted by Brett and Ethan). * Personally, I disagree with the notion of allowing a partial pass

[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-17 Thread Terry J. Reedy
Change by Terry J. Reedy : -- nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-17 Thread Terry J. Reedy
Terry J. Reedy added the comment: PR edits inspect._getmembers. I nosied people who have edited it previously. -- nosy: +ethan.furman, ping, pitrou, terry.reedy ___ Python tracker

[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-16 Thread hongweipeng
Change by hongweipeng : -- keywords: +patch pull_requests: +28367 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30147 ___ Python tracker ___

[issue46103] inspect.getmembers will call the instance __bases__ attribute, which may cause an exception

2021-12-16 Thread hongweipeng
onents: Library (Lib) messages: 408717 nosy: hongweipeng priority: normal severity: normal status: open title: inspect.getmembers will call the instance __bases__ attribute, which may cause an exception type: behavior versions: Python

[issue2516] Instance methods are misreporting the number of arguments

2021-11-23 Thread Irit Katriel
Irit Katriel added the comment: This seems to have been fixed by now, on 3.11 I get this: >>> class A: ... def foo(self, x): pass ... >>> A().foo() Traceback (most recent call last): File "", line 1, in TypeError: A.foo() missing 1 required positional argument: 'x' -- nosy:

[issue27544] Document the ABCs for instance/subclass checks of dict view types

2021-10-21 Thread Irit Katriel
Change by Irit Katriel : -- versions: +Python 3.11 -Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2021-10-21 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11. -- nosy: +iritkatriel versions: +Python 3.11 -Python 3.5, Python 3.6 ___ Python tracker ___

[issue43468] functools.cached_property incorrectly locks the entire descriptor on class instead of per-instance locking

2021-09-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: In addition to _NOT_FOUND and _EXCEPTION_RAISED, you could have an additional sentinel value _CONCURRENTLY_COMPUTING. Then you don't need to maintain a separate self.updater mapping. -- nosy: +pitrou ___ Python

[issue43468] functools.cached_property incorrectly locks the entire descriptor on class instead of per-instance locking

2021-08-26 Thread Alessio Bogon
Change by Alessio Bogon : -- nosy: +youtux ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44905] Abstract instance and class attributes for abstract base classes

2021-08-16 Thread Jacob Nilsson
Jacob Nilsson added the comment: Could one possible downside of this suggestion be, if implemented like in https://newbedev.com/python-abstract-class-shall-force-derived-classes-to-initialize-variable-in-init, a slowdown in code creating a lot of instances of a class with metaclass ABCMeta?

[issue44905] Abstract instance and class attributes for abstract base classes

2021-08-16 Thread Alex Waygood
Alex Waygood added the comment: ^And, that only works for class attributes, not instance attributes. -- ___ Python tracker <https://bugs.python.org/issue44

[issue44905] Abstract instance and class attributes for abstract base classes

2021-08-16 Thread Alex Waygood
Alex Waygood added the comment: Tomasz -- as discussed in the original BPO issue for `abstractmethod` implementations (https://bugs.python.org/issue1706989), this works as a workaround: ``` >>> from abc import ABCMeta >>> class AbstractAttribute: ... __isabstractmethod__ = True ...

  1   2   3   4   5   6   7   8   9   10   >