[issue38224] Windows embeddable distribution doesn't ship headers

2019-09-19 Thread Leblond Emmanuel


New submission from Leblond Emmanuel :

I don't understand why the headers are not provided as part of the distribution.

It would be really easy to rm them once the distribution extracted for usecases 
that don't need them.

On the other hand, usecases that need them cannot just download the Include 
folder from the CPython git repository given they get cooked during the build 
phase.

It's also really inconvenient to extract the headers from the executable 
distribution.

>From my personal experience, this prevented me from using the distribution 
>each time it would have been a good fit for my need:
- Embedding CPython into the Godot game engine (see 
https://github.com/touilleMan/godot-python/blob/284f092d9f7893403f7af32cac5978532c0e7d21/platforms/windows-64/SCsub#L55-L62)
- Providing a frozen distribution of python for a script with simple .exe 
binary that would initialize the CPython insterpeter and run a simple "import 
mymodule; mymodule.main()" command

--
components: Build, Windows
messages: 352778
nosy: paul.moore, steve.dower, tim.golden, touilleMan, zach.ware
priority: normal
severity: normal
status: open
title: Windows embeddable distribution doesn't ship headers
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue27240] 'UnstructuredTokenList' object has no attribute '_fold_as_ew'

2016-06-06 Thread Leblond Emmanuel

New submission from Leblond Emmanuel:

The folding code for email headers crashes whenever it hits line 
_header_value_parser.py:432 given it try to call method `_fold_as_ew`.

```
(venv)➜  vigiechiro-api git:(in2p3) ✗ python test_mail.py  
Traceback (most recent call last):
  File "test_mail.py", line 36, in 
mail.send(msg)
  File 
"/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py",
 line 492, in send
message.send(connection)
  File 
"/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py",
 line 427, in send
connection.send(self)
  File 
"/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py",
 line 190, in send
message.as_bytes() if PY3 else message.as_string(),
  File 
"/home/emmanuel/projects/vigiechiro-api/venv/lib/python3.5/site-packages/flask_mail.py",
 line 385, in as_bytes
return self._message().as_bytes()
  File "/usr/lib/python3.5/email/message.py", line 179, in as_bytes
g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
  File "/usr/lib/python3.5/email/generator.py", line 195, in _write
self._write_headers(msg)
  File "/usr/lib/python3.5/email/generator.py", line 422, in _write_headers
self._fp.write(self.policy.fold_binary(h, v))
  File "/usr/lib/python3.5/email/policy.py", line 190, in fold_binary
folded = self._fold(name, value, refold_binary=self.cte_type=='7bit')
  File "/usr/lib/python3.5/email/policy.py", line 204, in _fold
return self.header_factory(name, ''.join(lines)).fold(policy=self)
  File "/usr/lib/python3.5/email/headerregistry.py", line 255, in fold
return header.fold(policy=policy)
  File "/usr/lib/python3.5/email/_header_value_parser.py", line 300, in fold
self._fold(folded)
  File "/usr/lib/python3.5/email/_header_value_parser.py", line 1228, in _fold
rest._fold(folded)
  File "/usr/lib/python3.5/email/_header_value_parser.py", line 432, in _fold
part._fold_as_ew(folded)
AttributeError: 'UnstructuredTokenList' object has no attribute '_fold_as_ew'
> /usr/lib/python3.5/email/_header_value_parser.py(432)_fold()
-> part._fold_as_ew(folded)
```

Given folding depends a lot on the processed value, this bug only trigger in 
very specific encoded headers (I've try to reproduce this bug with various 
values but only the one which originally made me find the bug worked so far).

I've isolated the bug into a simple test case (see enclosed file).

It seems this part of the code has been rewritten between Python2 and 3 (the 
file _header_value_parser.py doesn't exists in Python2). So unsurprisingly the 
bug doesn't trigger in Python2.

Replacing `part._fold_as_ew(folded)` by `part._fold(folded)` seems to fix the 
bug, but given my poor knowledge of this code, this fix probably produce 
unwanted behaviors.

--
components: email
files: test_mail_2.py
messages: 267525
nosy: Leblond Emmanuel, barry, r.david.murray
priority: normal
severity: normal
status: open
title: 'UnstructuredTokenList' object has no attribute '_fold_as_ew'
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43257/test_mail_2.py

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