[Python-Dev] Re: compiled python3.10 is unable to find _ssl

2022-05-24 Thread Lou King
Christian Heimes wrote:
> For PEP 644 I added new instructions how to build Python 3.10 with 
> custom OpenSSL builds. The instructions should work on all major Linux 
> distributions. They have been tested on Debian-like and Fedora-like 
> platforms:
> https://docs.python.org/3/using/unix.html?highlight=openssl#custom-openssl

CentOS Linux release 7.9.2009 (Core)
trying to build python 3.10.4

I followed the instructions at 
https://docs.python.org/3/using/unix.html?highlight=openssl#custom-openssl and 
cannot import ssl in the resulting build.

My log of what I did follows. Struggling with this for a couple of days, so any 
help would be appreciated.

2022-05-24 11:24 sudo find /etc/ -name openssl.cnf -printf "%h\n"
/etc/pki/tls
2022-05-24 11:27 cd /home/lking/openssl/openssl-1.1.1o
2022-05-24 11:27 sudo ./config --prefix=/usr/local/custom-openssl --libdir=lib 
--openssldir=/etc/pki/tls
2022-05-24 11:28 sudo make clean
2022-05-24 11:29 sudo make -j1 depend
2022-05-24 11:29 sudo make -j > logs/build1.txt
2022-05-24 11:32 sudo make install_sw > logs/install_sw.txt
2022-05-24 11:33 cd /home/lking/python/Python-3.10.4
2022-05-24 11:34 ./configure -C --with-openssl=/usr/local/custom-openssl 
--with-openssl-rpath=auto --prefix=/usr/local/python-3.10.4 > 
logs/configure4.txt
2022-05-23 11:35 vim /home/lking/python/Python-3.10.4/Makefile # 
https://stackoverflow.com/a/50855855/799921
199c199
< RUNSHARED=
---
> RUNSHARED=LD_LIBRARY_PATH=/usr/local/custom-openssl/lib
2022-05-24 11:37 sudo make clean
2022-05-24 11:38 sudo make -j > logs/buildlog4.txt
2022-05-24 11:42 sudo make altinstall > logs/altinstall4.txt
2022-05-24 11:43 [lking@loutility-server-digitalocean Python-3.10.4]$ python3.10
Python 3.10.4 (main, May 15 2022, 12:44:05) [GCC 4.8.5 20150623 (Red Hat 
4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.10/ssl.py", line 98, in 
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/PNC7IT64YAVR72TVQPLBRSTC5XD6BCAY/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Riddle: Funny decorator chaining behaviour

2022-05-24 Thread Jesus Cea
Chatting in a Spanish python podcast about how convenient would be for 
abstract classes to raise exceptions intermediately instead of at 
instantiation time (how could you create an abstract class in that 
case?), somebody produced this code:


import abc

class a(abc.ABC):
  @classmethod
  @property
  @abc.abstractmethod
  def x(cls):
print("Hello world")

class b(a):
  def x(*args):
pass

(NOTHING happens, the abstract method/property is overriden)

class c(a):
  pass

"HELLO WORLD" is printed, creating the class (not instanciating an 
object of that type but creating the class itself), because the abstract 
method/property is not overriden.


Note that the method is called at class creation time.

if you replace the body of "x" method with a "raise NotImplementedError" 
you can produce that exception at import time, if some class remains 
abstract.


This is an interesting interaction between decorators trying to be 
clever supporting both regular and abstract methods/properties.


Trying to figure out how it worked took some time and python source code 
diving. I think this is interesting enough to share.


I don't think this is a bug to solve, just some brain teasing. I let 
other to decide what to do with this... collateral effect.


Let me know what do you think after trying to understand how it works.

--
Jesús Cea Avión _/_/  _/_/_/_/_/_/
[email protected] - https://www.jcea.es/_/_/_/_/  _/_/_/_/  _/_/
Twitter: @jcea_/_/_/_/  _/_/_/_/_/
jabber / xmpp:[email protected]  _/_/  _/_/_/_/  _/_/  _/_/
"Things are not so easy"  _/_/  _/_/_/_/  _/_/_/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/_/_/_/  _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz


OpenPGP_signature
Description: OpenPGP digital signature
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/VJ5PWJNU325SVVIBTRPCEUYOERBKGNWA/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Riddle: Funny decorator chaining behaviour

2022-05-24 Thread Steven D'Aprano
I believe that your example is the same as this recently opened bug 
report.

https://github.com/python/cpython/issues/93167


-- 
Steve
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/ZIJWJS7DPPP5QSUYS5LOXRQ7BYATNQNJ/
Code of Conduct: http://python.org/psf/codeofconduct/