Commit 85d2817
bpart: Tweak
In d2cc061 and prior commits, we made
backdated access a conditional error (if depwarns are enabled or in
generators). However, we did not touch `isdefinedglobal`. This resulted
in the common pattern `isdefinedglobal(m, s) && getglobal(m, s)` to
sometimes error. In particular, this could be observed when attempting
to print a type from inside a generated function before that type's
definition age.
Additionally, I think the usage there, which used `invokelatest` on each
of the two queries is problematic because it is racy, since the two
`invokelatest` calls may be looking at different world ages.
This makes two tweaks:
1. Makes `isdefinedglobal` consistent with `getglobal` in that it now
returns false if `getglobal` would throw due to the above referenced
restriction.
2. Removes the implicit `invokelatest` in _isself in the show code.
Instead, it will use the current world. I considered having it use the
exception age when used for MethodErrors. However, because this is used
for printing it matters more how the object can be accessed *now* rather
than how it could have been accessed in the past.
(cherry picked from commit fb59b6d)isdefinedglobal on backdated constant (#58976)1 parent 1de29dc commit 85d2817
3 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1474 | 1474 | | |
1475 | 1475 | | |
1476 | 1476 | | |
1477 | | - | |
| 1477 | + | |
| 1478 | + | |
1478 | 1479 | | |
1479 | | - | |
1480 | | - | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1481 | 1485 | | |
1482 | 1486 | | |
1483 | 1487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
560 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
561 | 567 | | |
562 | 568 | | |
563 | 569 | | |
| |||
0 commit comments