summaryrefslogtreecommitdiff
path: root/ext/date/date_core.c
AgeCommit message (Collapse)Author
2025-12-06[ruby/date] Call rb_gc_register_mark_object after object allocationPeter Zhu
It's possible that both half_days_in_day and day_in_nanoseconds are Ruby objects, which means that creating day_in_nanoseconds may trigger GC. Since half_days_in_day is not registered as a mark object until after day_in_nanoseconds is allocated, the GC may reclaim half_days_in_day. We can see this crash: ruby(rb_print_backtrace+0xb) [0x63a373c0] vm_dump.c:1105 ruby(rb_vm_bugreport) vm_dump.c:1450 ruby(rb_assert_failure_detail+0xdb) [0x6371d3a2] error.c:1216 ruby(RB_FL_TEST_RAW+0x0) [0x6371d3d5] error.c:1192 ruby(rb_assert_failure) (null):0 ruby(rb_gc_impl_writebarrier+0xb4) [0x636f01e4] gc/default/default.c:6103 ruby(pin_array_list_append+0x72) [0x638f9787] include/ruby/internal/gc.h:788 ruby(rb_vm_register_global_object) vm.c:4713 ruby(rb_gc_register_mark_object+0x3a) [0x6374144a] gc.c:3449 .ext/i686-linux-gnu/date_core.so(Init_date_core+0x204) [0xdbec86c4] ext/date/date_core.c:9511 .ext/i686-linux-gnu/date_core.so(Init_date_core) (null):0 ruby(dln_load_and_init+0x71) [0x6392c541] dln.c:521 ruby(dln_load_feature+0xd2) [0x6392c7d2] dln.c:566 ruby(load_ext+0xc3) [0x637931b3] load.c:1210 ruby(rb_vm_pop_frame+0x0) [0x638f80cd] vm.c:3120 ruby(rb_vm_call_cfunc_in_box) vm.c:3122 ruby(rb_long2num_inline+0x0) [0x637956f8] load.c:1353 ruby(require_internal) load.c:1354 ruby(rb_require_string_internal+0x60) [0x63795fa1] load.c:1457 ruby(rb_require_string) load.c:1443 https://github.com/ruby/date/commit/cbec5948e0
2025-11-27Reorganize page documentations (#15154)Stan Lo
Re-organize page docs
2025-10-06[ruby/date] `Date._parse` does not accept `nil`Nobuyoshi Nakada
https://github.com/ruby/date/commit/545066ca28
2025-10-06[ruby/date] Do not repeat conversions to stringNobuyoshi Nakada
https://github.com/ruby/date/commit/159e1ebb7f https://github.com/ruby/date/commit/4f7b6c9b42
2025-09-15[ruby/date] Suppress maybe-uninitialized warning by gcc-13Nobuyoshi Nakada
https://github.com/ruby/date/commit/afaa4a997b
2025-06-15[ruby/date] [Bug #21436] check for fixnum lower bound in `m_ajd`Dmitry Dygalo
Issue - https://bugs.ruby-lang.org/issues/21436 Apparently, the lower bound check is missing, which results in overflow & wrapping later on in RB_INT2FIX Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com> https://github.com/ruby/date/commit/67d75e8423
2025-06-15[ruby/date] [Bug #21437] Date#hash for large yearsDmitry Dygalo
Addresses https://bugs.ruby-lang.org/issues/21437 Signed-off-by: Dmitry Dygalo <dmitry.dygalo@workato.com> https://github.com/ruby/date/commit/31f07bc576
2025-06-13[ruby/date] d_lite_marshal_load: copy ivars in the right orderJean Boussier
https://github.com/ruby/date/commit/dbf4e957dc
2025-06-13[ruby/date] Remove references to FL_EXIVARJean Boussier
This flag isn't really meant to be public, it's an implementation detail of Ruby. And checking it before calling `rb_copy_generic_ivar` only save a function call. https://github.com/ruby/date/commit/8175252653
2025-06-05[ruby/date] Suppress warnings by gcc-13 with `-Og`Nobuyoshi Nakada
https://github.com/ruby/date/commit/6dd7969a64
2024-12-15[ruby/date] Fix broken rdoc-ref to the calendar pageStan Lo
https://github.com/ruby/date/commit/cb52e64be1
2024-11-29[ruby/date] Fix mixed declarations and codeNobuyoshi Nakada
This still support ruby 2.6 which does not require C99. https://github.com/ruby/date/commit/61d849758f
2024-11-05[ruby/date] Extract Julian calendar epoch literalsNobuyoshi Nakada
https://github.com/ruby/date/commit/e677e99a86
2024-11-05[ruby/date] Update `argc` by `rb_scan_args` not to contain keywordsNobuyoshi Nakada
https://github.com/ruby/date/commit/f277463439
2024-11-05[ruby/date] Fix incorrect argc2 decrement in datetime_s_iso8601 functionDmitrii Zudin
Replace the decrement (argc2--) with an increment (argc2++) for the correct number of arguments when opt is provided. https://github.com/ruby/date/commit/b6974b00d8
2024-07-02Resize arrays in `rb_ary_freeze` and use it for freezing arrayseileencodes
While working on a separate issue we found that in some cases `ary_heap_realloc` was being called on frozen arrays. To fix this, this change does the following: 1) Updates `rb_ary_freeze` to assert the type is an array, return if already frozen, and shrink the capacity if it is not embedded, shared or a shared root. 2) Replaces `rb_obj_freeze` with `rb_ary_freeze` when the object is always an array. 3) In `ary_heap_realloc`, ensure the new capa is set with `ARY_SET_CAPA`. Previously the change in capa was not set. 4) Adds an assertion to `ary_heap_realloc` that the array is not frozen. Some of this work was originally done in https://github.com/ruby/ruby/pull/2640, referencing this issue https://bugs.ruby-lang.org/issues/16291. There didn't appear to be any objections to this PR, it appears to have simply lost traction. The original PR made changes to arrays and strings at the same time, this PR only does arrays. Also it was old enough that rather than revive that branch I've made a new one. I added Lourens as co-author in addtion to Aaron who helped me with this patch. The original PR made this change for performance reasons, and while that's still true for this PR, the goal of this PR is to avoid calling `ary_heap_realloc` on frozen arrays. The capacity should be shrunk _before_ the array is frozen, not after. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-Authored-By: methodmissing <lourens@methodmissing.com>
2024-06-03[ruby/date] [DOC] specify the unit of return value for Date#-p0pemaru
https://github.com/ruby/date/commit/b3a2c7611e
2024-06-03[ruby/date] Prevent converted gregorian date from GCNobuyoshi Nakada
`m_sf_in_sec` calls `rb_rational_new` that can cause GC. https://github.com/ruby/date/commit/6de449ab6a
2024-02-21[ruby/date] Remove the unintentional ability to parse `Symbol`Nobuyoshi Nakada
It's been 2 years since ruby/date#49, so it's okay. https://github.com/ruby/date/commit/435dfec6c8
2023-09-20[ruby/date] [DOC] Fix linkBurdetteLamar
https://github.com/ruby/date/commit/2adb917487
2023-02-19[ruby/date] Removed (newly unneeded) alias remarksBurdette Lamar
(https://github.com/ruby/date/pull/88) https://github.com/ruby/date/commit/cfa7e9868b
2022-12-18[ruby/date] Adjust format [ci skip]Nobuyoshi Nakada
https://github.com/ruby/date/commit/71c35b4054
2022-12-13[ruby/date] Implement Date#deconstruct_keys and DateTime#deconstruct_keyszverok
https://github.com/ruby/date/commit/6bb6d3a810
2022-10-27[ruby/date] Check month range as civilNobuyoshi Nakada
2022-10-12[DOC] Replace the external URIs to docs with rdoc-refNobuyoshi Nakada
2022-08-15[ruby/date] [DOC] Enhanced intro for Date (https://github.com/ruby/date/pull/72)Burdette Lamar
https://github.com/ruby/date/commit/59a6673221
2022-08-08[ruby/date] Fix Time#to_datetime before calendar reformNobuyoshi Nakada
Time is always in the proleptic Gregorian calendar. Also DateTime#to_time should convert to the Gregorian calendar first, before extracting its components. https://bugs.ruby-lang.org/issues/18946#change-98527 https://github.com/ruby/date/commit/b2aee75248
2022-08-07[DOC] New doc about Julian/Gregorian (#70)Burdette Lamar
2022-08-03[ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/69)Burdette Lamar
Treats: ::_strptime ::strptime Adds 'Related' entry to some methods' doc. https://github.com/ruby/date/commit/a6c2129273
2022-08-03[ruby/date] [DOC] Enhanced RDoc for parser methods ↵Burdette Lamar
(https://github.com/ruby/date/pull/68) Treats: ::_httpdate ::_iso8601 ::_jisx0301 ::_parse ::_rfc2822 ::_rfc3339 ::_xmlschema ::httpdate ::iso8601 ::jisx0301 ::parse ::rfc2822 ::rfc3339 ::xmlschema https://github.com/ruby/date/commit/24bdab600a
2022-07-31[ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/67)Burdette Lamar
Treats: ::httpdate #to_date #to_time #to_datetime In behalf of ::httpdate, I've introduced section "Argument limit" that can be pointed to by various Date methods (similar to existing section "Argument start"). This will involve 8 already-enhanced methods plus 8 more not yet done. https://github.com/ruby/date/commit/00326ff99c
2022-07-30[ruby/date] [DOC] Enhanced RDoc (https://github.com/ruby/date/pull/66)Burdette Lamar
Treats: #=== #to_s #inspect #strftme #asctime #iso3601 #rfc3339 #rfc2822 #httpdate #jisx0301 https://github.com/ruby/date/commit/aed66fedf6
2022-07-29[ruby/date] [DOC] Enhanced RDoc for <=> (https://github.com/ruby/date/pull/65)Burdette Lamar
https://github.com/ruby/date/commit/0cdbaa92e9
2022-07-27Manually sync with https://github.com/ruby/date/pull/64Hiroshi SHIBATA
2022-07-12[ruby/date] [DOC] Enhanced RDoc (https://github.com/ruby/date/pull/63)Burdette Lamar
Treats: #next #<< #>> #next_month #prev_month #next_year #prev_year #step #upto #downto https://github.com/ruby/date/commit/4246441a35
2022-07-12[ruby/date] [DOC] Enhanced RDoc (https://github.com/ruby/date/pull/62)Burdette Lamar
Minor edits to 11 methods' documentation. https://github.com/ruby/date/commit/00bb7f6648
2022-07-10[ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/61)Burdette Lamar
Omit private aliases from Rdoc. https://github.com/ruby/date/commit/48f9180663
2022-07-09[ruby/date] [DOC] Enhanced RDoc (https://github.com/ruby/date/pull/59)Burdette Lamar
Minor changes (mostly doc-guide compliance) to 18 or so of simpler methods (getters). https://github.com/ruby/date/commit/00e37ba2b4
2022-07-08[ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/58)Burdette Lamar
Brings a dozen call-seq schemas into compliance with the doc guide. Adds links to section "Argument start" where needed. Revises (minorly) ::today. Otherwise, does not disturb existing text. https://github.com/ruby/date/commit/9aec11df50
2022-07-07[ruby/date] [DOC] Enhanced RDoc (https://github.com/ruby/date/pull/57)Burdette Lamar
All things commercial. https://github.com/ruby/date/commit/9d3bc61728
2022-07-05[ruby/date] Update ext/date/date_core.cBurdette Lamar
https://github.com/ruby/date/commit/8eb1c780fb Co-authored-by: Peter Zhu <peter@peterzhu.ca>
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/e36690f70e
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/dcc0742623
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/91c632f156
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/5c18ec031e
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/fd3ae275c3
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/ac25182c66
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/f9ecaad2ee
2022-07-05[ruby/date] Enhanced RDocBurdetteLamar
https://github.com/ruby/date/commit/e80fee4f30
2022-02-25[ruby/date] Suppress declaration-after-statement warningsNobuyoshi Nakada
https://github.com/ruby/date/commit/60bd16009d