Conversation
This was referenced Sep 11, 2026
jeremyevans
approved these changes
Sep 13, 2026
jeremyevans
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me other than whitespace issues in the tests.
|
|
||
| ["\t", "\n", "\v", "\f", "\r"].each do |sep| | ||
| h = assert_deprecated_warn(pat) do | ||
| Date._rfc3339("2001-02-03#{sep}04:05:06Z") |
Contributor
There was a problem hiding this comment.
We should avoid mixing tabs and specs in new lines. Can you update this to avoid tab usage in the new tests?
RFC 3339 allows only "T", and by convention a space, between the date and the time, but Date._rfc3339 also accepts \t, \n, \v, \f and \r. Warn on those under Warning[:deprecated] before they become an error. The separator is now captured so rfc3339_cb can inspect it, which shifts the remaining group indices.
Author
|
Thanks — tabs replaced with spaces in the new test. Re-ran |
youdie006
force-pushed
the
rfc3339-separator-deprecation
branch
from
September 14, 2026 00:44
76cd40e to
a2baceb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to ruby/time#85, where you specified the approach:
Date.rfc3339,DateTime.rfc3339andDate._rfc3339accept seven separators:T, a space, and\t\n\v\f\r. This warns on the last five underWarning[:deprecated], changing nothing else, so they can becomeDate::Errorlater.Adding the capture group shifts the remaining groups, so
SNUMgoes 8 to 9 and thehour/min/sec/sec_fraction/zoneindices move up by one.One deviation from your suggestion
rb_warning_category_enabled_pis not usable from an extension: it is in no public header, and on 3.4 it is not exported from libruby at all (nm -D libruby.so | grep -c rb_warning_category_enabled_pis 0). Building with it fails on ruby 2.7 ('RB_WARN_CATEGORY_DEPRECATED' undeclared) and on ruby 3.4 (implicit declaration of function).So the warning goes through
rb_category_warn, which is public and whichext/date/extconf.rb:10already probes, with the#ifndef HAVE_RB_CATEGORY_WARNfallbackdate_core.c:4690-4692already uses so the gemspec's 2.6 floor keeps building. That also makes the outer guard redundant:rb_category_warnreports only when$VERBOSEis non-nil and the category is enabled. Happy to change it if you had something else in mind.Verification
Date._rfc3339parses identically for all seven separators in every row; only the warning is new.date_parse.crevertedt/T/space check)T/t/space rowshourreadings[4](t|\s)to(?:t|\s), keep the renumberingtest/date, ruby 2.7.8test/date, ruby 3.2.11test/date, ruby 3.4.10test_date_parse.rb, truffleruby 3.3.7With deprecation warnings off, which is the default, nothing is emitted.
I kept this on its own branch so it stays independent of #190.
Disclosure: I used Claude (an AI assistant) while preparing this change. Every result above I ran and verified myself.