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

Argument Clinic: Touch source file if any output file changed #64595

Open
larryhastings opened this issue Jan 26, 2014 · 10 comments
Open

Argument Clinic: Touch source file if any output file changed #64595

larryhastings opened this issue Jan 26, 2014 · 10 comments
Assignees
Labels
build The build process and cross-build topic-argument-clinic type-feature A feature request or enhancement

Comments

@larryhastings
Copy link
Contributor

larryhastings commented Jan 26, 2014

BPO 20396
Nosy @ncoghlan, @larryhastings, @zware, @serhiy-storchaka

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/larryhastings'
closed_at = None
created_at = <Date 2014-01-26.14:02:21.527>
labels = ['type-feature', 'expert-argument-clinic']
title = 'Argument Clinic: Touch source file if any output file changed'
updated_at = <Date 2015-02-25.15:25:31.345>
user = 'https://github.com/larryhastings'

bugs.python.org fields:

activity = <Date 2015-02-25.15:25:31.345>
actor = 'serhiy.storchaka'
assignee = 'larry'
closed = False
closed_date = None
closer = None
components = ['Argument Clinic']
creation = <Date 2014-01-26.14:02:21.527>
creator = 'larry'
dependencies = []
files = []
hgrepos = []
issue_num = 20396
keywords = []
message_count = 3.0
messages = ['209315', '209318', '209323']
nosy_count = 4.0
nosy_names = ['ncoghlan', 'larry', 'zach.ware', 'serhiy.storchaka']
pr_nums = []
priority = 'low'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue20396'
versions = []

Linked PRs

@larryhastings
Copy link
Contributor Author

A minor bug, but still one that could cause confusion. It's already bitten me once.

If I change the code generator in clinic.py, then --make everything, files using the "file" destination often won't change. All the changes to the generated code will go in the generated file. And since the UNIX build process ignores those generated files, it doesn't rebuild the source file. I'd have to use "--make -f".

This won't just happen to me though. If you update your trunk and run "make clinic" this could easily happen to you too.

I propose that Clinic handle this as follows: if the generated file changes, but the source file does not, it "touches" the source file. (Technically I'll probably just rewrite the source file, as I already have code that does that.)

@larryhastings larryhastings self-assigned this Jan 26, 2014
@larryhastings larryhastings added the type-feature A feature request or enhancement label Jan 26, 2014
@serhiy-storchaka
Copy link
Member

It should first touch source file and then generated file. So that the date of generated file is always later the date of source file.

@ncoghlan
Copy link
Contributor

With Serhiy's modification, sounds like a reasonable plan to me.

@erlend-aasland
Copy link
Contributor

Resolved, taking Serhiy's and Nick's remarks into account, with:

carljm added a commit to carljm/cpython that referenced this issue May 5, 2023
* main: (61 commits)
  pythongh-64595: Argument Clinic: Touch source file if any output file changed (python#104152)
  pythongh-64631: Test exception messages in cloned Argument Clinic funcs (python#104167)
  pythongh-68395: Avoid naming conflicts by mangling variable names in Argument Clinic (python#104065)
  pythongh-64658: Expand Argument Clinic return converter docs (python#104175)
  pythonGH-103092: port `_asyncio` freelist to module state (python#104196)
  pythongh-104051: fix crash in test_xxtestfuzz with -We (python#104052)
  pythongh-104190: fix ubsan crash (python#104191)
  pythongh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (pythongh-104129)
  pythonGH-104142: Fix _Py_RefcntAdd to respect immortality (pythonGH-104143)
  pythongh-104112: link from cached_property docs to method-caching FAQ (python#104113)
  pythongh-68968: Correcting message display issue with assertEqual (python#103937)
  pythonGH-103899: Provide a hint when accidentally calling a module (pythonGH-103900)
  pythongh-103963: fix 'make regen-opcode' in out-of-tree builds (python#104177)
  pythongh-102500: Add PEP 688 and 698 to the 3.12 release highlights (python#104174)
  pythonGH-81079: Add case_sensitive argument to `pathlib.Path.glob()` (pythonGH-102710)
  pythongh-91896: Deprecate collections.abc.ByteString (python#102096)
  pythongh-99593: Add tests for Unicode C API (part 2) (python#99868)
  pythongh-102500: Document PEP 688 (python#102571)
  pythongh-102500: Implement PEP 688 (python#102521)
  pythongh-96534: socketmodule: support FreeBSD divert(4) socket (python#96536)
  ...
jbower-fb pushed a commit to jbower-fb/cpython-jbowerfb that referenced this issue May 8, 2023
@erlend-aasland
Copy link
Contributor

My patch was faulty; make clinic now touch pretty much every file with clinic code. So, gh-104152 actually made stuff worse than the previous status quo.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 15, 2023
Check if any clinic output actually changes any of the output files
before deciding if we should touch the source file. This needs to be
done before we eventually update the source file.
erlend-aasland added a commit that referenced this issue May 16, 2023
Check if any clinic output actually changes any of the output files
before deciding if we should touch the source file.
@erlend-aasland
Copy link
Contributor

carljm added a commit to carljm/cpython that referenced this issue May 16, 2023
* main:
  pythonGH-104510: Fix refleaks in `_io` base types (python#104516)
  pythongh-104539: Fix indentation error in logging.config.rst (python#104545)
  pythongh-104050: Don't star-import 'types' in Argument Clinic (python#104543)
  pythongh-104050: Add basic typing to CConverter in clinic.py (python#104538)
  pythongh-64595: Fix write file logic in Argument Clinic (python#104507)
  pythongh-104523: Inline minimal PGO rules (python#104524)
  pythongh-103861: Fix Zip64 extensions not being properly applied in some cases (python#103863)
  pythongh-69152: add method get_proxy_response_headers to HTTPConnection class (python#104248)
  pythongh-103763: Implement PEP 695 (python#103764)
  pythongh-104461: Run tkinter test_configure_screen on X11 only (pythonGH-104462)
  pythongh-104469: Convert _testcapi/watchers.c to use Argument Clinic (python#104503)
  pythongh-104482: Fix error handling bugs in ast.c (python#104483)
  pythongh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (pythongh-104437)
  pythonGH-102613: Fix recursion error from `pathlib.Path.glob()` (pythonGH-104373)
@erlend-aasland erlend-aasland reopened this Jul 5, 2023
@erlend-aasland
Copy link
Contributor

#104507 introduced a regression which in practice makes clinic unusable. Clearly, the current ClinicExternalTest test is not sufficient; we need to be able to catch errors as serious this in CI.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 5, 2023
ambv pushed a commit that referenced this issue Jul 5, 2023
)

Revert the two commits that introduced the regressions:

 - gh-104152
 - gh-104507
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 5, 2023
… Clinic (python#106449)

Revert the two commits that introduced the regressions:

 - pythongh-104152
 - pythongh-104507

(cherry picked from commit 9d1d4f9)

Co-authored-by: Erlend Aasland <erlend@python.org>
erlend-aasland added a commit that referenced this issue Jul 5, 2023
#106449) (#106452)

Revert the two commits that introduced the regressions:

 - gh-104152
 - gh-104507

(cherry picked from commit 9d1d4f9)
carljm added a commit to carljm/cpython that referenced this issue Jul 5, 2023
* main: (39 commits)
  pythongh-102542 Remove unused bytes object and bytes slicing (python#106433)
  Clarify state of CancelledError in doc (python#106453)
  pythongh-64595: Fix regression in file write logic in Argument Clinic (python#106449)
  pythongh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (python#106443)
  tp_flags docs: fix indentation (python#106420)
  pythongh-104050: Partially annotate Argument Clinic CLanguage class (python#106437)
  pythongh-106368: Add tests for formatting helpers in Argument Clinic (python#106415)
  pythongh-104050: Annotate Argument Clinic parameter permutation helpers (python#106431)
  pythongh-104050: Annotate toplevel functions in clinic.py (python#106435)
  pythongh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h (python#106434)
  Add some codeowners for `Tools/clinic/` (python#106430)
  pythongh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (python#106423)
  pythongh-61215: Rename `wait_until_any_call` to `wait_until_any_call_with` (python#106414)
  pythongh-106162: array: suppress warning in test_array (python#106404)
  pythongh-106320: Remove _PyInterpreterState_HasFeature() (python#106425)
  pythonGH-106360: Support very basic superblock introspection (python#106422)
  pythongh-106406: Fix _Py_IsInterpreterFinalizing() in _winapi.c (python#106408)
  pythongh-106396: Special-case empty format spec to gen empty JoinedStr node (python#106401)
  pythongh-106368: Add tests for permutation helpers in Argument Clinic (python#106407)
  pythonGH-106008: Fix refleak when peepholing `None` comparisons (python#106367)
  ...
@hugovk
Copy link
Member

hugovk commented Jan 11, 2024

Triage: the fix PR has been merged, can this be re-closed?

@erlend-aasland
Copy link
Contributor

Triage: the fix PR has been merged, can this be re-closed?

No, the fix introduced a regression, so it had to be reverted :( I'll see if I can find time in the coming weeks to fix this.

@erlend-aasland
Copy link
Contributor

I'm not sure this is worth fixing in Argument Clinic. It is a limitation with how we've set up the build system. A more modern build system would detect the #include dependencies automatically. We can chose to fix this in the Makefile (or just wait until a new build system is in place).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build topic-argument-clinic type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants