Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.8 cgi.escape() deprecated #4

Open
MarkUoLeeds opened this issue Oct 27, 2020 · 4 comments
Open

python 3.8 cgi.escape() deprecated #4

MarkUoLeeds opened this issue Oct 27, 2020 · 4 comments

Comments

@MarkUoLeeds
Copy link

Deprecated since version 3.2: This function is unsafe because quote is false by default, and therefore deprecated. Use html.escape() instead.

your code failed on a modern system perhaps I should contact LLVM directly?

@androm3da
Copy link
Owner

This happened when running llvm/utils/opt-viewer/opt-viewer.py?

The llvm release used in this repo is quite old. You could try updating with a newer one.

@MarkUoLeeds
Copy link
Author

hello thank you for your quick response. I only came to this repo as directed by someone else. I was using it to guide me in how to use optviewer. I realise now that this repo is not the version of what is installed.
The LLVM installed on the system I am using has an AMD variation so probably outside your control. Sorry to have bothered you.
The system is also providing Python 3.8; maybe if i find a way of using an older Python it could work. Or maybe I should take it up with AMD.

if it helps for clarification this is the version of FLANG based on LLVM:

earmgr@uan01:~> flang --version
AOCC.LLVM.2.1.0.B1030.2019_11_12 clang version 9.0.0 (CLANG: Build#1030) (based on LLVM AOCC.LLVM.2.1.0.B1030.2019_11_12)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/AMD/aocc-compiler-2.1.0/bin

thanks again

@eaniemey
Copy link

So, switching to html.escape() allowed the script to process further, but it fails with the following:
python3 ./opt-viewer/opt-viewer.py *.opt.yaml html
Reading YAML files...
Rendering index page...
Rendering HTML files...
42 of 83multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/Users/eaniemey/Desktop/working/opt-viewer/optpmap.py", line 25, in wrapped_func
return func(argument, filter
)
File "/Users/eaniemey/Desktop/working/opt-viewer/opt-viewer.py", line 247, in _render_file
SourceFileRenderer(source_dir, output_dir, filename, no_highlight).render(remarks)
File "/Users/eaniemey/Desktop/working/opt-viewer/opt-viewer.py", line 188, in render
self.render_source_lines(self.source_stream, line_remarks)
File "/Users/eaniemey/Desktop/working/opt-viewer/opt-viewer.py", line 109, in render_source_lines
self.render_inline_remarks(remark, html_line)
File "/Users/eaniemey/Desktop/working/opt-viewer/opt-viewer.py", line 112, in render_inline_remarks
inlining_context = r.DemangledFunctionName
File "/Users/eaniemey/Desktop/working/opt-viewer/optrecord.py", line 145, in DemangledFunctionName
return self.demangle(self.Function)
File "/Users/eaniemey/Desktop/working/opt-viewer/optrecord.py", line 69, in demangle
with cls.demangler_lock:
AttributeError: type object 'Passed' has no attribute 'demangler_lock'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/eaniemey/Desktop/working/./opt-viewer/opt-viewer.py", line 383, in
main()
File "/Users/eaniemey/Desktop/working/./opt-viewer/opt-viewer.py", line 372, in main
generate_report(all_remarks,
File "/Users/eaniemey/Desktop/working/./opt-viewer/opt-viewer.py", line 296, in generate_report
optpmap.pmap(_render_file_bound,
File "/Users/eaniemey/Desktop/working/opt-viewer/optpmap.py", line 50, in pmap
result = pool.map(_wrapped_func, func_and_args, *args, **kwargs)
File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
AttributeError: type object 'Passed' has no attribute 'demangler_lock'

Run on MacOS 10.15..7 with Python 3.9 and Clang version 12.0.0 (clang-1200.0.32.21)

@eaniemey
Copy link

Follow-up on this. When I run the script with -j 1 (single process, no multiprocessing) it works as expected. So, I suspect there is an issue with the oppmap.py script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants