https://github.com/JuliaLang/julia
Revision 91455710f38f226e45591203b0d4cd8e392131fd authored by Keno Fischer on 22 March 2024, 09:37:18 UTC, committed by GitHub on 22 March 2024, 09:37:18 UTC
I don't like `jl_filename`/`jl_lineno`. They are weird internal state,
and they are also not thread safe, so if different threads are evaling
different things at the same time, line numbers can get confused.

This PR changes the core function `jl_toplevel_eval_flex` to keep track
of its current file/line context on the stack, so at least there is no
confusion within one call to this function.

With this PR and #53797, the global `jl_filename`/`jl_lineno` are used
for three purposes:

1. To initialize the filename/lineno used by lowering from `Core.eval`.
2. To give binding deprecation warnings.
3. For `jl_critical_error`.
4. By humans in the debugger.

I think 3 and 4 are fine, they are exceptional cases. Case 2, I think
could be changed to plumb through locations explicitly,
 but it's a bit annoying, so I didn't tackle it here.
Case 1, I think can probably just be changed to consistently initialize,
and if you want a proper line number, you need to put it in there
explicitly.
However, I didn't change that in this PR, because I think it could be
slightly
 breaking, so should be pkgeval'd.
1 parent 6c22dfd
History
Tip revision: 91455710f38f226e45591203b0d4cd8e392131fd authored by Keno Fischer on 22 March 2024, 09:37:18 UTC
Use jl_filename/jl_lineno less (#53799)
Tip revision: 9145571
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 571 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 1012 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 388.1 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 56.0 KB
Makefile -rw-r--r-- 30.3 KB
NEWS.md -rw-r--r-- 4.4 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.9 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 37.8 KB
pkgimage.mk -rw-r--r-- 1.4 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top